This update query is not working it just hangs
UPDATE tempimportmailer ti
SET lead_id = leads.id
FROM leads
INNER JOIN tempimportmailer
ON leads.full_name = tempimportmailer.name AND
leads.address = tempimportmailer.add1 AND
leads.zip_code = tempimportmailer.zip
WHERE tempimportmailer.lead_id = 0
I have also tried the following, but the results were not what I had anticipated, the lead_numbers did not match up correctly when I viewed the tempimportmailer table.
UPDATE tempimportmailer
SET lead_id = leads.id
FROM leads
WHERE leads.full_name = tempimportmailer.name AND leads.address = tempimportmailer.add1 AND
leads.zip_code = tempimportmailer.zip
AND tempimportmailer.lead_id = 0;
I am new to PostgreSQL so please go easy on me.