IF EXISTS (SELECT * FROM two_player WHERE title='math' and user2 is null)
UPDATE two_player SET score2='50' , user2='zahra' WHERE title='math' and user2 is null
ELSE
INSERT INTO two_player (user1,score1,title) values ('zahra', '50', 'math')
This query works right in sql server. But I am getting this error in the mysql:
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 two_player WHERE title='math' and user2 is null) ' at line 1
why?! is there any alternative for that?
Aucun commentaire:
Enregistrer un commentaire