I want to perform an SQL update
UPDATE incCustomer SET etaxCode = 'HST' WHERE
only on records where this is true.
select etaxCode
from incCustomer
left join incAddress on incCustomer.iAddressId = incAddress.iId
left join incProvince on incAddress.iProvinceStateId = incProvince.iId
where incAddress.iProvinceStateId in ( 2 , 3 , 4 , 6 , 9 )
I don’t think that this is possible with ANSI SQL, but can it be done in MySQL?
MySQL UPDATE syntax supports joins in both ANSI-89 and ANSI-92 syntax.
Use:
I don’t see the point of LEFT JOINing to the province table – I think your UPDATE could be written as: