0
我想解决一个错误。 虽然我正在分析这个查询,但遇到了一个错误。'IF EXISTS'附近的Synatx错误
IF EXISTS (SELECT * FROM category_info WHERE category_name = 'Electronics')
BEGIN
select * from category_info;
END
ELSE
BEGIN
insert into category_info(category_name) values('Electronics');
END
错误:
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 category_info WHERE category_name = 'Electronics') BEG' at line 1
我需要帮助,提前
看看这里:https://stackoverflow.com/questions/5528854/usage-of-mysqls-if-exists –
[如何在MySQL中插入'如果不存在'?](https:/ /stackoverflow.com/questions/1361340/how-to-insert-if-not-exists-in-mysql) – GolezTrol
[MySQL的使用“IF EXISTS”](https://stackoverflow.com/questions/5528854/usage-of-mysqls-if-exists) –