Any ideas as to why this query doesn't work on mariadb? It seems to follow the pattern on the mariadb documentation site
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) );
Error Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'EXCEPT ( SELECT t1.visitid, t1. patientid, t1.visitdate FROM db.medi_o' at line 8