I have two tables: account_company and document_invoice. The account_company table has 2 columns: company_id and company_name. The document_invoice table has the same columns: company_id and company_name. Something happened and delete all the data from the column company name from the invoice_document.
How can I write an SQL query to copy data from the company table of the company to the invoice_document? I use UPDATE and SET, but I donβt know exactly how to do this.
UPDATE document_invoice SET company_name = (SELECT company_name FROM account_company) WHERE document_id.company_name=document_id.account
source share