I think I have a conflict between my knowledge on SQL Server and MySQL.
When I run this query, I get an error always from MySQL:
If EXISTS (select * from tbl_admin) THEN
select 'OK';
END IF;
The error message is:
[Err] 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 EXISTS (select * from tbl_admin) then select ‘1’
— select ‘1’ WHERE EXISTS ‘ at line 1
Please help me and tell me am I wrong in writing this query? What’s wrong?
I want to do something if I have something in tbl_admin table.
edit
To check if a table contains data you can do this: