lol*_*ola 2 mysql sql mysql-error-1064
为什么我得到错误:
#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 id FROM mytable WHERE id = '1')' at line 1
Run Code Online (Sandbox Code Playgroud)
查询:
IF EXISTS(SELECT id FROM mytable WHERE id = '1')
Run Code Online (Sandbox Code Playgroud)
谢谢
IF EXISTS仅适用于存储过程.在存储过程之外,IF()是一个带有3个参数的函数.适当的用法是
SELECT IF(EXISTS(SELECT `column` FROM `table` WHERE `id` = `1`), 1, 0);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5740 次 |
| 最近记录: |