0

I have a table (example_table_1) which has a timestamp column declared as follows:

`ts1` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP

This MySQL statement generates a syntax error:

CREATE TABLE example_table_2 AS
SELECT DATETIME(ts1)
FROM example_table_1

How do I get my second table to have the TIMESTAMP data as a DATETIME column?

1
  • The specific error message that you're receiving would be very helpful. Commented Nov 6, 2011 at 10:00

1 Answer 1

2
create table example_table_2 as
select cast(ts1 as datetime) as ts1
from example_table_1
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.