每次我尝试在DBeaver上编译此代码时,它都会在第一个AND语句所在的位置给我一个语法错误。我不知道该怎么解决。
SELECT idintervento as _IDInterventoRif, idcdc, idcartella,
(SELECT COUNT(DISTINCT idintervento) as nInt
FROM cch.pats_cch_interventi i
WHERE (idtiporecord in('UTI','INT'))
AND i.idcdc = inter.idcdc
AND i.idcartella = inter.idcartella
AND i.utiingressodata < inter.utiingressodata
AND i.idintervento <> inter.idintervento
) as _IDInterventoTipoN
FROM cch.pats_cch_interventi inter
WHERE (idtiporecord in('INT') OR idtiporecord IS NULL)
AND idintervento <> ?
AND idcdc = ?
AND idcartella = ?
AND (dataintervento < ?
OR dataintervento = ? AND idintervento < ?)
ORDER BY idcdc, idcartella, utiingressodata desc;