关于此查询为何不适用于mariadb的任何想法?似乎遵循了mariadb文档网站上的模式
SELECT ... (INTERSECT | EXCEPT | UNION [ALL | DISTINCT]) SELECT ...
( SELECT t1.visitid, t1. patientid, t1.visitdate
FROM db.medi_officevisit t1
WHERE t1.visitdate = (SELECT t2.visitdate
FROM db.medi_officevisit t2
WHERE t2.PatientID = t1.PatientID and VISITdate >= '2018-01-01'
ORDER BY t2.visitID DESC
LIMIT 1) )
EXCEPT
( SELECT t1.visitid, t1. patientid, t1.visitdate
FROM db.medi_officevisit t1
WHERE t1.visitdate = (SELECT t2.visitdate
FROM db.medi_officevisit t2
WHERE t2.PatientID = t1.PatientID and VISITdate >= '2017-01-01' and VISITDATE <= '2018-01-01'
ORDER BY t2.visitID DESC
LIMIT 1) );
错误代码:1064。您的SQL语法有错误;检查 对应于您的MariaDB服务器版本的手册 在'EXCEPT(SELECT t1.visitid,t1。Patientid, 第8行的t1.visitdate FROM db.medi_o'
答案 0 :(得分:0)
EXCEPT
已在MariaDB 10.3.0版中添加。您需要升级您的MariaDB版本才能执行此操作。