Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy DATETIME from one table to another

Status
Not open for further replies.

rduncan10

IS-IT--Management
Jun 15, 2004
4
US
I'm trying to copy a DATETIME field from one table to another using an INSERT statement like this:

[tt]INSERT INTO table2 (value1, date1)
SELECT (value1, date1)
FROM table2;[/tt]

MySQL gives me this error:

[tt]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 ' date1) FROM table2'[/tt]

Date1 is a DATETIME field in both tables. I'm not trying to insert the current date or a timestamp. Date1 needs to move unchanged.

Thanks,
Rob
 
Thanks.

That's kind of embarassing. In my defense, the documentation I was using (O'Reilly MySQL pocket reference) showed brackets, though I now see the manual on MySQL.com does not.

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top