With a simple transaction as
START TRANSACTION;
UPDATE posts SET status='approved' where post_id='id' AND status != 'approved';
.. other queries ...
COMMIT;
I want to perform the transaction only once when changing the status; but the above UPDATE
will not give an error to rollback the transaction when no row is updated.
How can I limit the transaction to commit only if the row is updated (I mean the status is changed).