Re: converting multiple update queries into case statement
CASE
WHEN (CURDATE() < startdate)
THEN id_group = '24'
WHEN (CURDATE() BETWEEN startdate AND enddate)
THEN id_group = '23'
WHEN (CURDATE() > enddate)
THEN id_group = '20'
ELSE id_group
END
without the bolded part it would set all values of id_group to null that didn't match one of the other CASEs above. your column is likely set to NOT NULL and thus generates the error.
---------------
Guelphdad,
Moderator
forums.mysql.com
Subject
Written By
Posted
Re: converting multiple update queries into case statement
August 17, 2010 08:06PM
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.