I have two tables. The table I am trying to update is table A which doesn't have some IDs ProfileIDs. At the other hand table B has all the IDs. I am trying to update the column in Table A based on a query. When I join the tables I get all the results in my query and as i try to update/insert the results in my column I get a cannot insert into my table. I am intending to insert my results with the following query
insert into TableA a
(profileID)
select b.profileID
from tableA
join TableB B on B.userID = A.userID
where a.profileID = '' or a.profileID is null
Table A Table B
UserID | profileID | lastname | Firstname UserID | profileID | lastname | Firstname
0012356 Wung Clara 0012356 15963 Wung Clara
0512356 14753 Williams Michael 0512356 14753 Williams Michael
0956356 Walters Jeff 0956356 94356 Walters Jeff
0486312 68956 Wwagner George 0486312 68956 Wwagner George
select A.*, B.profileID
from TableA A
join TableB B on B.userID = A.userID
Results
UserID | profileID | lastname | Firstname
0012356 15963 Wung Clara
0512356 14753 Williams Michael
0956356 94356 Walters Jeff
0486312 68956 Wwagner George