I am trying to run a MYSQL query having conditional statement, but it continuously showing me a error, please help me to come out.
QUERY:
IF 1 > 0 THEN
SELECT * FROM table1;
ELSE
SELECT * FROM table2;
END IF;
ERROR:
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF 1 > 0 THEN
SELECT * FROM table1' at line 1
Firstly Thanks for your replies, and I am don't want to use any PHP code I will just directly run that query to MYSQL console. Actually I am trying to use conditional statements of MYSQL. I searched for that & I got but that all was not clear.