Jul 25, 2008

Order By Within Group By

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Order By Within Group By

MacFly
I want to return the results of a series of races, and display them in their
final placing (1st, 2nd 3rd etc, which is determined by a total_seconds time
field) within each race (which will take place on different event_date
days).

$Query="SELECT * FROM events GROUP BY event_date ORDER BY total_seconds";
won't cut it (even I can see why!) but I can't think how to.

I suppose I *could* go to two tables and JOIN but I'd rather use just one
line of code if that's possible.

Can anyone help?

Reply

nooc
Perhaps you pnly want to sort the table, first by date, then by time?
CODE
SELECT * FROM events ORDER BY event_date DESC, total_seconds;

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics
Looking for order, group

Searching Video's for order, group
advertisement



Order By Within Group By



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE