Friday, March 30, 2012

Order by string...?

hey everyone...

at the moment, I have 3 status types of items in my db... approved, pending & draft...

what im wanting to know is...

can i do a ORDER BY [status is Draft] so that any items where status (VARCHAR) is draft is at the top of the list..

I can't do alphabetical order...because d is inbetween A & P...

CheersORDER
BY CASE WHEN status = 'draft'
THEN 1
ELSE 937 END
, status
, item_name

No comments:

Post a Comment