Andurit
Andurit

Reputation: 5762

Select from one database , insert to another - MySQL

I am trying to basicly copy data from one database to another (just some of them) what i need is to:

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

Answers (1)

Aman Aggarwal
Aman Aggarwal

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

Related Questions