MySQL Forums
Forum List  »  Newbie

iF ELSE END IF
Posted by: Michael Smith
Date: February 10, 2023 04:20PM

I am trying to check for the word 'Total' in a particular column and add a row if necessary.

Here's what I have tried:

SELECT COUNT(ITEM) FROM products01 AS V1 WHERE ITEM = Total';
IF (V1 = 0) THEN
INSERT INTO products01 (ITEM) VALUES ('Total');
END IF;

This statement generates a lot of error messages.

What am I doing wrong?

Mike

Options: ReplyQuote


Subject
Written By
Posted
iF ELSE END IF
February 10, 2023 04:20PM
February 14, 2023 08:12AM
February 26, 2023 08:00AM


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.