MySQL Forums
Forum List  »  Newbie

Re: converting multiple update queries into case statement
Posted by: Devart Team
Date: August 17, 2010 12:00AM

Try this query -

UPDATE
  `smf_members`
SET
  id_group = 
  CASE
    WHEN (CURDATE() < startdate) THEN '24'
    WHEN (CURDATE() BETWEEN startdate AND enddate) THEN '23'
    WHEN (CURDATE() > enddate)THEN '20'
  END;

Devart Company,
MySQL management tools
http://www.devart.com/dbforge/mysql/

Options: ReplyQuote




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.