RE: MySQL SQL Case Stetement

2004-06-18 Thread Paul McNeil
I have used the CASE statement for ordering many times. It's very useful... SELECT myDATA, CASE WHEN data2 = SomeValue THEN 0 ELSE WHEN data2 = SomeOtherValue THEN 1 ELSE 2 END AS mySort from MyTable Where myConstraints. God Bless Paul C. McNeil Developer in Java, MS-SQL, MySQL, and web

Re: MySQL SQL Case Stetement

2004-06-18 Thread Michael Stassen
The CASE function is documented in the manual http://dev.mysql.com/doc/mysql/en/Control_flow_functions.html. SELECT CASE WHEN other_col 100 THEN 'low' WHEN other_col BETWEEN 100 AND 1000 THEN 'medium' WHEN other_col 1000 THEN 'high' END AS col FROM your_table; Michael Rafi