phpmo Posted January 11, 2008 Share Posted January 11, 2008 Ok I have 2 tables. Table1 Table 2 ID ID Name T1ID Age I'm wanting to sort the data in Table 1 by the Age column in Table 2 and then display NAME as it appears in order of AGE. In this case ID on table 1 is the same and T1ID on table 2. Is there a way to do this? Quote Link to comment https://forums.phpfreaks.com/topic/85584-solved-sort-table-1-by-data-in-table-2/ Share on other sites More sharing options...
toplay Posted January 11, 2008 Share Posted January 11, 2008 SELECT t1.Name , t2.Age FROM Table1 t1 JOIN Table2 t2 ON t2.T1ID = t1.ID ORDER BY t2.Age ASC # or use DESC for descending ; Quote Link to comment https://forums.phpfreaks.com/topic/85584-solved-sort-table-1-by-data-in-table-2/#findComment-436749 Share on other sites More sharing options...
phpmo Posted January 11, 2008 Author Share Posted January 11, 2008 worked great thanks! Quote Link to comment https://forums.phpfreaks.com/topic/85584-solved-sort-table-1-by-data-in-table-2/#findComment-436835 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.