OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Complex conditional statement during select

From: Jay Blanchard (jblanchardpocket.com)
Date: Thu Aug 28 2008 - 08:43:15 CDT


SELECT this, that, theOther,
SUM(IF(SUBSTRING(myDate,1,10) >= '20080101' AND SUBSTRING(myDate,1,10)
<= '20080131'), 1, 0) AS `January`
FROM theTable
GROUP BY theOther

Throws this error...

ERROR 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near ')), 1, 0) AS `January`

Can I even do something like this during the SELECT. I tried a BETWEEN
and while it did not throw errors it did not give back the expected
data...I just got 0

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql