There are two tables, tb1, tb2tb1 table structure id (primary key), nametb2 table structure id (primary key), type (primary key), content, note, and datetype. the optional values are:, b, c, d, etb1, and tb2 are one-to-many relationships. id is used to associate the following data types... mySQL database SQL
There are two tables, tb1 and tb2.
Table structure of tb1
Id (primary key), name
Table structure of tb2
Id (primary key), type (primary key), content, note, date
Type: a, B, c, d, e
Tb1, tb2 is a one-to-many relationship, associated by id
For example, the following data
Tb1
Id name
01 tom
02 jim
Tb2
Id type content note date
01 a xxx1 xx1 20130102
01 B xxx2 x 2 20130103
01 c xxx3 xx3 20130103
01 d xxx4 xx4 20130103
01 e xxx5 xx5 20130103
02 B xxx4 xx4 20130103
02 e xxx5 xx5 20130103
I want to extract such data now
Id name type1 content1 note1 date1 type2 content2 note2 date2 type3 content3 note3 date3...
01 tom a xxx1 xx1 20130102 B xxx2 xx2 20130103 c xxx3 xx3 20130103...
02 jim B xxx4 xx4 20130103...
Write an SQL statement with the highest execution efficiency. I use MYSQL,
And do not use the so-called temporary table of MYSQL.