Thanks to Benno Rem for pointing out the ORDER BY FIELD(..) that one can use in MySQL. Now to find a way to use it in MSSQL 2000. Wrong group for that I guess. 8-O

Bryan wrote:
By the way, I want the numbers to list out in the order I have them in the statement, not numerically and not randomly like it does now.


Thanks...

Bryan wrote:
If I have a SQL statement using the IN clause, how do I keep the order of the list?

Example:
SELECT * FROM table WHERE (number in (5, 9, 3, 4, 1, 7, 2, 8, 6))

How would I pull records in the order of the numbers to list out as:
5 - Record 5
9 - Record 9
3 - Record 3
4 - Record 4
1 - Record 1
7 - Record 7
2 - Record 2
8 - Record 8
6 - Record 6

Thanks so much...

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

Reply via email to