So I have three tables. I want the first table to match the third table based on their matching ids. Afterwards, I want the third table's id to be replaced by the second table's id (concat'd with a 'g' in front), which is identified through a select
query on the first and second table.
Here's my rough idea of how it should go, just not too sure of how to match, then use tbl2's id:
UPDATE tbl3 SET col=CONCAT('g',tbl2.id) WHERE
id IN (
SELECT tbl1.id, tbl2.id FROM tbl1 left join tbl2 on tbl1.id = tbl2.id
WHERE blah='blah');
Is this possible in MySQL alone or will I have to do it in php using multiple queries?