Gossamer Forum
Home : General : Databases and SQL :

SQL: distinct stuff...

Quote Reply
SQL: distinct stuff...
hey folks!

i have the followiong table example:

ID----Book-------Category
======================


1 ---- e ------------ b
2 ---- d ------------ b
3 ---- w ------------ a
4 ---- t ------------ a
5 ---- e ------------ c


what i'd like to do is get the Distinct categories, but sort them as they are in the DB, ie: according to the ID, to get this:

b
a
c



but when i write :

"SELECT DISTINCT category FROM tbl ORDER BY ID ASC", i get an error, saying that the "order" clashes with the "Distinct" .

anyone got ideas how to do this>?

thanks!
Snooper

Last edited by:

snooper: Feb 12, 2003, 8:04 AM
Subject Author Views Date
Thread SQL: distinct stuff... snooper 5427 Feb 12, 2003, 8:02 AM
Thread Re: [snooper] SQL: distinct stuff...
Stealth 5228 Feb 12, 2003, 10:32 AM
Post Re: [Stealth] SQL: distinct stuff...
snooper 5149 Feb 12, 2003, 11:14 AM