I'm working on something for someone that involves changing the quantity of something. If the quantity is 1 or less, we are going to remove the row from the table. If it is 2 or more, we will just update the 'quantity' column, so that it has been decreased by 1. I thought I would shorten the process to 1 query, but this doesn't seem to work and I'm not having any luck with Google. Does anyone have any ideas?
IF SELECT * FROM cart WHERE quantity <= 1 AND owner = 1 AND item = 6 THEN DELETE FROM cart WHERE owner = 1 AND item = 6; ELSE UPDATE cart SET quantity = quantity - 1 WHERE owner = 1 AND item = 6; END IF