Forums

PHP

This topic is locked

Order By Question

Posted 21 Mar 2003 14:58:59
1
has voted
21 Mar 2003 14:58:59 d sg posted:
Newbie question here, Im doing a site a the mo and have got the order by working fine as, but is there any way that it can order by two criterias, for example.
It's a travel site, so at the moment it orders fine with COUNTRY, easy as, but if i put these records into the database.
(COUNTRY) ENGLAND > (PLACE) LONDON then ENGLAND > YORK, then ENGLAND > LONDON,
IT will order it along COUNTRY but when viewing it on the page the place will go LONDON then YORK then back to LONDON,
So back to the point, is there anyway that i can first order by COUNTRY and then by PLACE, so everythings in a continious order,
Thanks alot Dan

Replies

Replied 21 Mar 2003 16:55:20
21 Mar 2003 16:55:20 Vince Baker replied:
in your sql add the following at the bottom:

ORDER BY COUNTRY ASC, PLACE ASC

You can add as many order criteria as you like, seperated with a comma and with ASC for ascending or DESC for descending.

Regards
Vince

Response.write("The best line of code you can ever use"

VBScript | ASP | HTML | SQL | Oracle | Hosting
Replied 24 Mar 2003 11:01:30
24 Mar 2003 11:01:30 d sg replied:
Cheers bakerv, Dan

Reply to this topic