czappa Posted February 25, 2009 Share Posted February 25, 2009 I have the following sql statment $query = "SELECT gymnasts.firstname, gymnasts.lastname, meet.meethost, meet.meetname, meet.meetdate, meetresults.level, meetresults.vault, meetresults.vaulplace, meetresults.unevenbars, meetresults.unevenbarsplace, meetresults.beam, meetresults.beamplace, meetresults.floor, meetresults.floorplace, meetresults.aaplace, meetresults.vault+meetresults.unevenbars+meetresults.beam+meetresults.floor AS AATotal, meetresults.agegroup, meetresults.ID, meet.meetid FROM meet INNER JOIN (gymnasts INNER JOIN meetresults ON gymnasts.gymnastid = meetresults.gymnastid) ON meet.meetid = meetresults.meetid WHERE meet.meetid=".$_GET['meetid'] ; the last section is being pulled from a link I want to add an ORDER by in the statment. ORDER BY meetresults.`level`, AATotal DESC where would i put it. the rules say it has to be last, but if i put it last it breaks when I run it. THANK YOU!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/ Share on other sites More sharing options...
revraz Posted February 25, 2009 Share Posted February 25, 2009 Post what you mean by "breaks", it does go at the end. Quote Link to comment https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/#findComment-771012 Share on other sites More sharing options...
premiso Posted February 25, 2009 Share Posted February 25, 2009 Post what you mean by "breaks", it does go at the end. Along with that, post how you changed it to make it "break" (the actual SQL you tried). Quote Link to comment https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/#findComment-771017 Share on other sites More sharing options...
czappa Posted February 25, 2009 Author Share Posted February 25, 2009 Parse error: syntax error, unexpected T_STRING in C:\xampp\htdocs\enateam\testreults.php on line 58 Quote Link to comment https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/#findComment-771019 Share on other sites More sharing options...
premiso Posted February 25, 2009 Share Posted February 25, 2009 (the actual SQL you tried). $query = "SELECT gymnasts.firstname, gymnasts.lastname, meet.meethost, meet.meetname, meet.meetdate, meetresults.level, meetresults.vault, meetresults.vaulplace, meetresults.unevenbars, meetresults.unevenbarsplace, meetresults.beam, meetresults.beamplace, meetresults.floor, meetresults.floorplace, meetresults.aaplace, meetresults.vault+meetresults.unevenbars+meetresults.beam+meetresults.floor AS AATotal, meetresults.agegroup, meetresults.ID, meet.meetid FROM meet INNER JOIN (gymnasts INNER JOIN meetresults ON gymnasts.gymnastid = meetresults.gymnastid) ON meet.meetid = meetresults.meetid WHERE meet.meetid=".$_GET['meetid'] . " ORDER BY meetresults.`level`, AATotal DESC"; Should work. Quote Link to comment https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/#findComment-771023 Share on other sites More sharing options...
czappa Posted February 25, 2009 Author Share Posted February 25, 2009 That did it thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/#findComment-771084 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.