We help IT Professionals succeed at work.

update colum 1 values with column 2 values mysql ?

aej1973
aej1973 used Ask the Experts™
on
Hi I am trying to run this query on my MySql db

update work_order set current_date = order_date;

but I keep getting this following error:

#1064 - 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 'current_date = order_date' at line 1

Both columns have type 'date'. Can someone let me know why this is happening and how I can do this update. Thanks.

A
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2012
Commented:
Current_date is a function in MySQL.

In MS SQL you must in close the current_Date for example like this.

update work_order set [current_Date] = order_date;

How you have it you are using the function called current_date and not pointing the query to the correct column

Author

Commented:
Thanks, that was the issue. [current_Date], did not work, but when I changed current_date to dateToday my initial query worked.

A

Author

Commented:
Thanks.