Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Server 2000 dataset sorting question

Status
Not open for further replies.

twhitney

Programmer
Mar 9, 2006
2
US
I'm trying to sort a SQL query while prioritizing one specific dataset - e.g.:

table: tbl_properties
field: prop_firmID

I want to list those properties where prop_firmID=32
and second, by price (which I got covered)


In other words - If I sort by prop_firmID - it will list properties associated with prop_firmID=1 first - is there a way to prioritize a specific ID value without creating another sort column?
 
Something like this ?
ORDER BY CASE WHEN prop_firmID=32 THEN 0 ELSE prop_firmID END, price

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
PHV - thanks - that looks good - I just tried this and it seemed to work:

ORDER BY CASE WHEN prop_firmID = 32 THEN prop_firmID ELSE prop_price END

I might try yours too.

Thanks again!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top