Reputation: 107
I have two tables.
GeneralTable
ID | Date | Invoice_Number | Accno
1 | 17/03/2016| 12334566 | 12546
Client_Table
ID | Date | Invoice_Number | Accno
6 | 14/02/2016| 12334566 | 125462
I need to pull the Date and Accno from Client_Table
to GeneralTable, the invoice_number is the unique field.
Result
GeneralTable
ID | Date | Invoice_Number | Accno
1 | 14/02/2016| 12334566 | 125462
Upvotes: 1
Views: 31
Reputation: 311228
You can use the update-join syntax:
UPDATE GeneralTable g
JOIN ClientTable c ON g.invoice_number = c.invoice_number
SET g.date = c.date, g.accno = c.accno
Upvotes: 2