Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Can't figure out query

Author  Topic 

mindhazed
Starting Member

1 Post

Posted - 2005-08-29 : 16:57:24
Hey all! Great forum!

Here's my problem:
http://www.corvettesofhouston.com/used-corvettes-for-sale/?mod=all-corvettes

I want Jeep to be listed last. The query that gives the result in order by model (i.e. C5, Jeep, Muscle Cars, etc.) is:
SELECT DISTINCT CatID FROM cars ORDER BY year DESC

I have a category table called cats that shares the same field CatID and a field called ordernumber (ordernumber is a count in order of how I want the categories).

If I want the sections to be listed in order of ordernumber in the cats table, how would I make a query like that?

Thank you so much in advance!!

-Paul

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-08-29 : 17:01:50
SELECT DISTINCT c.CatID
FROM cars c
INNER JOIN category cat
ON c.CatID = cat.CatID
ORDER BY cat.ordernumber DESC

Tara
Go to Top of Page
   

- Advertisement -