I have a select statement that joins several tables and captures some information. I would like to update all records in one of these tables (found in the list) with the information contained in select. The selection is as follows:
SELECT account.id document.id FROM customer INNER JOIN account ON (customer.firstname = account.firstname AND customer.lastname = account.lastname AND customer.phone = account.phone) INNER JOIN document ON customer.id = document.customerid WHERE document.accountid IS NULL;
In English, the document may be owned by customers and accounts. I am looking for account entries that match client accounts where the document belongs to the client but not the account.
Now I can manually view the results and run this:
UPDATE document SET accountid = WHERE id = ;
which works as I would like, but there is a decent amount of records that match my query, and I would like to do it in one expression, if I could.
source share