My update query records the registration number, make and model of an employees company vehicle on his personnel record from a vehicle register where the switch CURRENT is ='T'(True) However, if the employee surrenders his vehicle for a car allowance I need to clear the vehicle details from the personnel record. The current query is:
UPDATE EMPLOYEE.dbo.RECORD
SET EMPLOYEEMAKE = VEHICLEMAKE
EMPLOYEEMODEL = VEHICLEMODEL
EMPLOYEEREG = VEHICLEREG
FROM EMPLOYEE etc.
ON EMPLOYEEREG = VEHICLEREG
WHERE CURRENT ='T'
I need to clear EMPLOYEEMAKE, MODEL & REG WHERE CURRENT is NOT LIKE 'T'
How do I add the delete part?
UPDATE EMPLOYEE.dbo.RECORD
SET EMPLOYEEMAKE = VEHICLEMAKE
EMPLOYEEMODEL = VEHICLEMODEL
EMPLOYEEREG = VEHICLEREG
FROM EMPLOYEE etc.
ON EMPLOYEEREG = VEHICLEREG
WHERE CURRENT ='T'
I need to clear EMPLOYEEMAKE, MODEL & REG WHERE CURRENT is NOT LIKE 'T'
How do I add the delete part?