Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.
Moderator: General Moderators
ssand
Forum Commoner
Posts: 72 Joined: Sat Jun 22, 2002 9:25 pm
Location: Iowa
Post
by ssand » Thu Jun 27, 2002 11:44 am
I have a simple ORDER by:
Code: Select all
$sql = "SELECT * FROM classifieds order by run_date desc";
Is it possible to have it then sort by another column? So, the results are by run_date then ad_name (where ad_name is not desc)??
Steve
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Thu Jun 27, 2002 11:50 am
Have you tried,
Code: Select all
$sql = "SELECT * FROM classifieds ORDER BY run_date DESC, ad_name";
Mac
ssand
Forum Commoner
Posts: 72 Joined: Sat Jun 22, 2002 9:25 pm
Location: Iowa
Post
by ssand » Thu Jun 27, 2002 12:03 pm
thanks
Toneboy
Forum Contributor
Posts: 102 Joined: Wed Jul 31, 2002 5:59 am
Location: Law, Scotland.
Contact:
Post
by Toneboy » Fri Oct 25, 2002 10:09 am
Glad I did a search on here before posting a new topic!
Basically I have a small link system in place, and I would like to order it by the number of hits a link has had, but then if two links have had the same number of hits could you order those in ascending alphabetical order.
From the above example I'd imagine a line would look a bit like this:
"SELECT * FROM links ORDER BY hits DESC, name ASC"
Can anyone confirm this one way or another?
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Fri Oct 25, 2002 11:21 am
The
syntax for that looks right so all you need to do is try it out on your table content.
Mac