You can use an auxiliary lookup table:

FK_mygrade        rank
------------        -----
Secret                1
A+                       2
...

Now join this table to your SELECT query on FK_mygrade, add 'rank' to the
SELECT items,
and ORDER BY rank

HTH
Ignatius
____________________________________________
----- Original Message -----
From: "Steve Vernon" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, October 19, 2002 9:46 PM
Subject: [PHP-DB] Custom Sort Order in MySQL


Hiya,
    Just wondering what is the best way to get some data out of a database
in cutom order.

    They all have grades like A*, A, B, C and some are grade Secret.

    If I sort them by grade secret is at the bottom, I would like this at
the top. I realise I could get all the Secret's, then A*, then A as seperate
calls, but id prefer to get them all in the correct order as I belive this
will be faster.

    Any help would be very much appreciated.

                    Thanks!

                    Steve


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

Reply via email to