Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2005
    Posts
    55

    Unanswered: 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...

    Cheers

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    ORDER
        BY CASE WHEN status = 'draft'
                THEN 1
                ELSE 937 END
         , status
         , item_name
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •