Results 1 to 2 of 2

Thread: [RESOLVED] MySQL: ORDER BY ENUM value?

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2004
    Posts
    121

    Resolved [RESOLVED] MySQL: ORDER BY ENUM value?

    Hello all.
    I know that if you use an ENUM field, you can use ASC or DESC in an ORDER BY clause (which works great with two possible values)... But what if your ENUM field has three or more possible values?

    For instance, let us say I have an ENUM field:
    Code:
    marital_status ENUM('H','W','N')
    And I wanted to order the recordset, first by showing records where the value of the ENUM is "H", then records where the value is "W" followed by records where the value is "N". Is this even possible?

    Many thanks to anyone who can figure this one out.
    Last edited by solitario; May 16th, 2006 at 03:30 PM.

Posting Permissions

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



Click Here to Expand Forum to Full Width