MySQL Forums
Forum List  »  InnoDB

Grouping Data Into Ranges
Posted by: sainandoor
Date: July 11, 2005 07:09PM

I am trying to get the count for date in different ranges. I used the following query:
SELECT SUM(CASE WHEN CoilLength < 50 then 1 else 0 END CASE) as '50', SUM (CASE WHEN CoilLength between 50 and 100 then 1 else 0 END CASE) as '50to100',
SUM (CASE WHEN CoilLength > 100 then 1 else 0 END CASE) as '100' from tblCoiledCoil;

I get a generic syntax error. If I use END instead of END CASE I get an error saying function myDB.SUM doesn't exist. Any ideas on how to fix it?

Options: ReplyQuote


Subject
Views
Written By
Posted
Grouping Data Into Ranges
3838
July 11, 2005 07:09PM
2243
July 12, 2005 04:02AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.