|
-
May 16th, 2006, 02:50 PM
#1
Thread Starter
Lively Member
[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.
-
May 16th, 2006, 03:30 PM
#2
Thread Starter
Lively Member
Re: MySQL: ORDER BY ENUM value?
Seems to be working. For those interested:
Code:
ORDER BY
marital_status="H",
marital_status="W",
marital_status="N"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|