I have three tables.
Main_table:
id autoincrement
type enum(type1,type2)
....fields common for the other 2 tables....
Type1_table:
id (one-one relation with MAin_table)
.....fields specific for type1_table
Type2_table:
id (one-one relation with MAin_table)
.....fields specific for type2_table
At first I got data with 2 selects:
Code: Select all
SELECT *
FROM Main_tables aa
INNER JOIN Ttype1_table ab
USING ( id )But then I see I cannot use orderBY clause as results mix up.
And if I order by id....i take first type1 then type2 and it ultimately does not order things.
So I am thinking how could select whole data with one query...so I can orderby freely.
Tried this:
Code: Select all
SELECT * FROM Type1_table ab LEFT JOIN Main_Table aa USING (id )
RIGHT JOIN Type2_table at USING (id )Could someone help me with this issue? Thanks in advance for spending time.