I have two separate tables both with user id columns uid. I want to take a value from all users in one table and insert it into the correct row for the correct user in the other table.
INSERT INTO users2 (picture)
SELECT pv.value
FROM profile_values as pv, users2 as u
WHERE pv.uid = u.uid
AND pv.fid = 31
AND users2.uid=u.uid;
But it’s not working because i seem not to have access to users2.uid inside of the select statement.
How would I accomplish this?
You should be able to access your
ualias forusers2fine. Direct access tousers2isn’t possible because you’reINSERTing into it, so the row doesn’t actually exist yet. Do you want to do aninsertorupdate?