See this link.
Might me help for you
http://answers.yahoo.com/question/index?qid=20070309043307AATLe9k
On 5 February 2010 17:46, misiaQ <misiaq@stripped> wrote:
> Instead of:
> -> else 2003
>
> -> where id between 1 and 6;
> Try
> -> else 2003
> -> end
> -> where id between 1 and 6;
>
> Or maybe even:
> mysql> update table1
> -> set year=case when id IN (1, 2, 4) then 2000
> -> when id IN(2, 4, 6) then 2001
> -> else 2003
> -> end
> -> where id between 1 and 6;
>
> Good luck!
>
> Regards,
> m
>
> -----Original Message-----
> From: MuraliKrishna [mailto:murali_krishna@stripped]
> Sent: Friday, February 05, 2010 12:04 PM
> To: mysql@stripped
> Subject: help me out for this problem...
>
>
>
> Here I have to update year column with reference to the row id
>
>
>
>
>
> mysql> update table1
>
> -> set year=case when id=1 then 2000
>
> -> when id=2 then 2001
>
> -> when id=3 then 2000
>
> -> when id=4 then 2001
>
> -> when id=5 then 2000
>
> -> when id=6 then 2001
>
> -> else 2003
>
> -> where id between 1 and 6;
>
> 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
> 'where
>
> id between 1 and 6' at line 9
>
> mysql>
>
>
>
> ----------------------------------------------------------------------
> Urocze domki...
> Zobacz >>> http://link.interia.pl/f25aa
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=1
>
>
--
Ramesh