MySQL Forums
Forum List  »  MySQL Query Browser

Update two row values in mysql
Posted by: Jordan Pathsorious
Date: April 12, 2013 07:10PM

Hello Everyone,

I have been trying to update value 1 and 0 for two different conditions. I tried to use if.. else but it shows me error. Can i use two different update statement in same procedure? Please help me with it.

Below is my procedure:

DELIMITER $$
CREATE PROCEDURE update11()
BEGIN
Select x From table1 WHERE count1 <= quantity;
IF x= 0 then
UPDATE table1 SET x=1;
ELSE
UPDATE table1 SET x=0;
END IF;
END $$
DELIMITER;



Edited 1 time(s). Last edit at 04/12/2013 07:12PM by Jordan Pathsorious.

Options: ReplyQuote


Subject
Written By
Posted
Update two row values in mysql
April 12, 2013 07:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.