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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Order by (conditional?) 1

Status
Not open for further replies.

alexanderthegreat

IS-IT--Management
Sep 9, 2005
70
US
Is it possible to have sort of a order by conditional statement for

SELECT result, BATHS_FULL, BATHS_PART, BDRMS, MLS_NUMBER, PRICE, SCHOOLS_D, SCHOOLS_E, SCHOOLS_H, SQFT, TAX, YEAR_BUILT, ZIP, TOTAL_APT_UNITS, STYLE, CITY, COUNTY, Expr1, Expr2
FROM dbo.v_mult
ORDER BY result ASC, PRICE DESC

I want it to sort by result ASC first, but showing only those values that are not equal to a 0, then by PRICE.

Al
 
order by case when result > 0 then 0 else 1 end, result asc, price desc

?

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top