UPDATE
in a table (in the example table 'reservations'), based on information from another table (in the example the table 'administration'). Good until then I could do with the help of a person here of the forum ...
Example of what I already have: (perform the update in the 'reservations' table if there is no duplication of the same record in the 'administration' table).
UPDATES reservas t1 SET t1.status_reserva = 'Entregue' WHERE NOT EXISTS (SELECT * FROM administracao t2 WHERE t2.cod = t1.cod1 )
Now I need to do this, only by putting a filter so that UPDATE
executes only if the 'status_reserve' field is different from the word 'Canceled'.
I tried to do this, but it did not work:
UPDATES reservas t1 SET t1.status_reserva = 'Entregue' WHERE NOT EXISTS (SELECT * FROM administracao t2 WHERE t2.cod = t1.cod1 ) AND status_reserva != 'Cancelado'
Please someone who has a solution to this problem, or can not do this?!