Cant figure this simple sql out. crm_contact_id is updated with the same contact id throughout the table. I’m trying to get it to equal what the from query equals when I do the select.
update events set crm_contact_id = c.id
from events as evts
inner join crm2.crm_retail_lead l on l.lead_number = evts.old_lead_number
inner join crm_contacts c on c.old_contact_id = l.contact_id
Thanks for taking a look.
When you do:
you get two unrelated instances of the events table.
That’s probably not what you want. A fixed version would look like this: