I have defined a trigger on a table which fires everytime a row is inserted. When a row is inserted, I update a second table's 'status' column with the new row's status field as follows:
CREATE TRIGGER Status_insert_trigger
SET Status = i.status
INNER JOIN Inserted i ON i.ID = Customers.ID
This is working fine. I however have an additional requirement: If the i.status value is 'Offline' then I would also like to update the Customers table 'Active' field to 'NO'.
How can I do this in my SQL code?