Hey all,
Please, I'm totally stumped on how to set up an update query joining the following 3 tables.
Table 1 accounts_contacs
fields: id, accounts_id, contacts_id
Table 2 contacts
fields: id, agency_name
Table 3 accounts
fields: id, name
UPDATE contacts, accounts, accounts_contacts
SET contacts.agency_name = accounts.name
WHERE ......?
I'm assuming this will involve a HAVING clause, but not at all sure of the syntax.
Actually, the following appears to work, but just doesn't seem right somehow?
update contacts, accounts, accounts_contacts
set contacts.agency_name = accounts.name
where contacts.id = accounts_contacts.contact_id
and accounts.id = accounts_contacts.account_id