缠丝猫 发表于 2024-11-27 14:54:49

mysql报错1064 - You have an error in your SQL syntax; check the manua

 运行如下代码后报错: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 'INTERSECT
SELECT * FROM palyer WHERE exp BETWEEN 1 AND 5' at line 2
-- intersect:合并结果集(交集)
-- 仅显示同时满足这两个条件的值注意:MySQL版本大于8.0.31版本才能使用这个语句
SELECT * FROM palyer WHERE level BETWEEN 1 AND 7
INTERSECT
SELECT * FROM palyer WHERE exp BETWEEN 1 AND 5;

-- except:合并结果集(差集) 此语句适用版本同上
-- 查找等级在1-7但是经验不在1-5的玩家
SELECT * FROM palyer WHERE level BETWEEN 1 AND 7
EXCEPT
SELECT * FROM palyer WHERE exp BETWEEN 1 AND 5;  经查询发现,MySQL最新版本(8.0.31)的推出,MySQL才增加了对SQL尺度INTERSECT和EXCEPT表运算符的支持
假如低于此版本使用这两个表运算符的话会报错1064


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: mysql报错1064 - You have an error in your SQL syntax; check the manua