swatisonee Posted September 28, 2007 Share Posted September 28, 2007 Hi, I have the foll. $sql which works well. $sqla = "SELECT * FROM Customers c INNER JOIN Custaddress a USING(CID) INNER JOIN Cities t USING(CITYID) WHERE c.Company LIKE '%$customer%' ORDER BY Company asc"; But if I wish to do a sort on 3 fields in 3 different tables, i'm getting an error. $sqla = "SELECT * FROM Customers c INNER JOIN Custaddress a USING(CID) INNER JOIN Cities t USING(CITYID) WHERE c.Company LIKE '%$customer%' ORDER BY c. Company asc, t.City asc , a.Zip asc "; Is there a way I can change this please ? Thanks ! Quote Link to comment https://forums.phpfreaks.com/topic/71027-multiple-sorts-on-a-join-statement-using-3-tables/ Share on other sites More sharing options...
rarebit Posted September 28, 2007 Share Posted September 28, 2007 It looks right to me, so try taking out stuff until you find at which point it breaks down, then put back in another way... Quote Link to comment https://forums.phpfreaks.com/topic/71027-multiple-sorts-on-a-join-statement-using-3-tables/#findComment-357122 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.