IF (SELECT Category,Name FROM Category WHERE Name='Cat2')
THEN
ELSE
INSERT INTO Category VALUES ('','Cat2');
What Im trying to do is : If Cat2 doesnt exist in the Category table then add it.
My IF statement doesnt seem to be working. IF (SELECT * FROM Category WHERE Name='Cat1') THEN SELECT 'a';
is showing error.
The doc http://dev.mysql.com/doc/mysql/en/if-statement.html has no examples.