Re: Strange ORDER BY question(SOLUTION)

2004-01-12 Thread Roger Baklund
* Mike Johnson 
> From: Lewis, Jason [mailto:[EMAIL PROTECTED]
> 
> > Didn't know if anyone else might need this but I was given 
> > the solution.
> > 
> > SELECT * FROM tablename 
> > ORDER BY MemberLevel='Platinum' DESC, 
> > MemberLevel='Gold' DESC, 
> > MemberLevel='Silver' DESC, 
> > MemberLevel='Paying' DESC, 
> > MemberLevel='Non-Paying' DESC;
> > 
> > 
> > Thanks again Mike!
> 
> 
> Thanks for posting it, actually, as I wasn't aware of that 
> solution until your question prompted me to go looking.

I think using the FIELD() function is the easiest way:

SELECT * FROM tablename ORDER BY FIELD(MemberLevel,
  'Platinum','Gold','Silver','Paying','Non-Paying');

http://www.mysql.com/doc/en/String_functions.html#IDX1261 >

-- 
Roger

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Strange ORDER BY question(SOLUTION)

2004-01-12 Thread Mike Johnson
From: Lewis, Jason [mailto:[EMAIL PROTECTED]

> Didn't know if anyone else might need this but I was given 
> the solution.
> 
> SELECT * FROM tablename 
> ORDER BY MemberLevel='Platinum' DESC, 
> MemberLevel='Gold' DESC, 
> MemberLevel='Silver' DESC, 
> MemberLevel='Paying' DESC, 
> MemberLevel='Non-Paying' DESC;
> 
> 
> Thanks again Mike!


Thanks for posting it, actually, as I wasn't aware of that solution until your 
question prompted me to go looking.


-- 
Mike Johnson
Web Developer
Smarter Living, Inc.
phone (617) 886-5539

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Strange ORDER BY question(SOLUTION)

2004-01-12 Thread Lewis, Jason

Didn't know if anyone else might need this but I was given the solution.

SELECT * FROM tablename 
ORDER BY MemberLevel='Platinum' DESC, 
MemberLevel='Gold' DESC, 
MemberLevel='Silver' DESC, 
MemberLevel='Paying' DESC, 
MemberLevel='Non-Paying' DESC;


Thanks again Mike!


Jason

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]