IF STATEMENT
Posted by:
ryan liles
Date: December 11, 2006 02:26PM
I am trying to create a statement that checks a table to see if an entry exists and if it does run one select statement and if the the check comes back with 0 then run another select statement
This is what I have but it doesn't seem to run ? Am I way off ? I can post the exact detailed code but since I am a new to mySQL syntax I am sure it is something basic.
IF (SELECT COUNT(*) FROM table_Y WHERE field_X = 'string') = 1 THEN
SELECT .........
FROM ...........
WHERE ...........
ELSE
SELECT .........
FROM ...........
WHERE ..........
END IF
I tried to follow the format presented here:
http://mysql.osuosl.org/doc/refman/5.0/en/if-statement.html
THANKS
Subject
Written By
Posted
IF STATEMENT
December 11, 2006 02:26PM
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.