simpsimp Posted August 20, 2007 Share Posted August 20, 2007 Hi - this is a simple problem, but I'm still trying to figure out joins! Hope you can help. I have a table EVENTS and a table CONCERTS - CONCERTS has a row called TYPE. I just want to sort the EVENTS by the TYPE of CONCERT contained in the EVENTS. Sort of like - SELECT * from events ORDER BY events.concert.type ASC But I can't get this working. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/65833-solved-simple-join-problem/ Share on other sites More sharing options...
kirk112 Posted August 20, 2007 Share Posted August 20, 2007 how do you join the events table to the concerts table? If its on event_id then the following should work SELECT * FROM events AS e LEFT JOIN concerts AS c ON e.event_id = c.event_id ORDER BY c.type Quote Link to comment https://forums.phpfreaks.com/topic/65833-solved-simple-join-problem/#findComment-328954 Share on other sites More sharing options...
simpsimp Posted August 20, 2007 Author Share Posted August 20, 2007 Thanks Kirk112! The following did the trick:- SELECT * FROM live_event AS e LEFT JOIN live_concert AS c ON e.concert = c.id ORDER BY c.type This is the area of MySQL which makes my head hurt... Quote Link to comment https://forums.phpfreaks.com/topic/65833-solved-simple-join-problem/#findComment-328966 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.