Try this:

SELECT * FROM productgroup WHERE groupid = $productid
ORDER BY label = 'Cats' DESC, title

The test SQL I did to make sure I understood it was this (against our Users 
table):

select * from users order by first = 'Bob' DESC, first, last

It put all the "Bob"s first, sorting them by first/last, then put everyone else 
after the "Bob"s sorted by first/last.

If you don't put DESC on the 'Cats', it looks like it'll put the 'Cats' at the 
bottom of the list.

Also refer to the user comments here:
http://dev.mysql.com/doc/refman/4.1/en/sorting-rows.html

good luck!

-TG

= = = Original message = = =

SELECT * FROM productgroup WHERE groupid = $productid
AND label =  'Cats' ORDER BY title

SELECT * FROM productgroup WHERE groupid = $productid
AND label != 'Cats' ORDER BY label,title

I'd like to find a way to combine these 2 statements. I want to list out 
all the products, ordered by title but listing out all the Cats products 
first. Any way to do that without having separate statements?

Thanks...

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to