Jump to content

Recommended Posts

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!!!!!

Link to comment
https://forums.phpfreaks.com/topic/146857-solved-mysql-statement-help/
Share on other sites

(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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.