user3179854
user3179854

Reputation:

insert data from one mysql table to another

i am trying to run this SQL query to copy data from one table to another but it shows zero rows returned:

INSERT INTO ticket_updates 
VALUES
(
  SELECT * 
  FROM ticket_updates2 
  WHERE sequence = '4715'
)

Upvotes: 0

Views: 42

Answers (1)

crthompson
crthompson

Reputation: 15865

You cannot put a select statement into a values method.

Your syntax should look like this:

INSERT into ticket_updates(all,my,columns)
select all,my,columns from ticket_updates2 where sequence = '4715'

Upvotes: 3

Related Questions