MySQL: Trying to populate data into one column from another table

Table A has several columns, including FirstName and LastName Table B has different columns, including FirstName, LastName and EmployeeID

I added EmployeeID into Table A. I now want to populate Table A's Employee ID's from Table B's Employee ID's, using the first and last name (we currently have no one working with the same name - the design of this table was weird like that)

I've attempted a few things, but I keep coming back to

INSERT INTO TableA (EMPLOYEE_ID) A
SELECT B.EMPLOYEE_ID FROM TableB B
WHERE A.First_name = B.First_name
AND A.Last_name = B.Last_name

But I keep getting a syntax error - MySQL server version for the right syntax to use near A. I don't know how to use this syntax when dealing with Insert statements, I think, or if this is the right way at all.

6
задан AAEM 2 January 2019 в 04:42
поделиться