MySql. What is there error on this insert+select+where statement?
- by acidzombie24
What is wrong with this statement? It works with sqlite and MS sql (last time i tested it)
I would like a select unless there is no match with name or email. Then i would like to insert. I have it as one statement because its easy to keep concurrent safe as one statement. (its not that complex of a statement).
INSERT INTO `user_data` (
`last_login_ip`, `login_date`,
...) SELECT
@0,
@14 WHERE not exists (SELECT * FROM `user_data` WHERE `name` = @15 OR
`unconfirmed_email` = @16 LIMIT 1);
Exception
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 'WHERE not exists (SELECT * FROM `user_data` WHERE `name` = 'thename' OR
`unconfirmed' at line 31