Reputation: 5762
I am trying to basicly copy data from one database to another (just some of them) what i need is to:
take data from old database SELECT name, lastname, email, phone FROM codexworld.person WHERE id="544"
insert that values to another table INSERT INTO legaljobs.candidates (name, lastname, email, phone) VALUES ( name , lastname, email, phone)
What I did try is:
INSERT INTO legaljobs.candidates (name, lastname, email, phone)
VALUES (SELECT name, lastname, email, phone FROM codexworld.person WHERE id="544")
unfortunately this throw me an error on SQL syntax. Please can somebody advise how can I do this really simple?
Upvotes: 0
Views: 1138
Reputation: 18459
Use this query:
INSERT INTO legaljobs.candidates (name, lastname, email, phone)
SELECT name, lastname, email, phone FROM codexworld.person WHERE id="544"
Upvotes: 2