how do I update the date type column?

Posted by Muhammad Hammad on Stack Overflow See other posts from Stack Overflow or by Muhammad Hammad
Published on 2010-04-06T06:28:01Z Indexed on 2010/04/06 6:33 UTC
Read the original article Hit count: 351

Filed under:
update answers a1 
   set a1.FilingDate=(
                       select date_sub( a2.FilingDate
                                       ,Interval 1000 Year) as FilingDate
                       from answers a2 
                       where Year(a2.FilingDate)>=3000
                     )
where Year(a1.FilingDate)>=3000

but it gives me the following error:

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 'update answers a1 set a1.FilingDate=( select date_sub(a2.FilingDate,Interval 10' at line 1

Can anyone tell me about the issue and its solution?

© Stack Overflow or respective owner

Related posts about sql