Demonic Posted September 29, 2006 Share Posted September 29, 2006 Can someone tell me how I could order a table by another tables Id using Join mysql syntax.Its confusing.Select * FROM table1,table2 ORDER BY table2.idIs that how I would do it? Link to comment https://forums.phpfreaks.com/topic/22444-join/ Share on other sites More sharing options...
extrovertive Posted September 29, 2006 Share Posted September 29, 2006 A simple joinSELECT * FROM table1 t1JOIN table2 t2ON t1.id = t2.id ORDER BY t2.id Link to comment https://forums.phpfreaks.com/topic/22444-join/#findComment-100625 Share on other sites More sharing options...
Demonic Posted September 29, 2006 Author Share Posted September 29, 2006 can you explain that? the t1 and t2 threw me off bad.(same thing happened when looking at the manual ???) Link to comment https://forums.phpfreaks.com/topic/22444-join/#findComment-100629 Share on other sites More sharing options...
extrovertive Posted September 29, 2006 Share Posted September 29, 2006 t1 is just a short name label for table1.You can still use the original table1 name.SELECT * FROM table1 JOIN table2ON table1.id = table2.id ORDER BY table2.idsame thing.Another way to join is:SELECT * FROM table1, table2WHERE table1.id = table2.idORDER BY table2.idHowever, the first method is better since there's more things with you can do using a JOIN clause. Link to comment https://forums.phpfreaks.com/topic/22444-join/#findComment-100631 Share on other sites More sharing options...
Demonic Posted September 29, 2006 Author Share Posted September 29, 2006 K Thanks :) Ill try it now. (to see if it really works :O) Link to comment https://forums.phpfreaks.com/topic/22444-join/#findComment-100636 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.