我需要一个查询来删除所有重复的记录,但只保留一个基于valid_until
日期列的最新记录.我试了试下面的,但上面写着An expression of non-boolean type specified in a context where a condition is expected, near ','.
DELETE FROM tableOne
WHERE (id, valid_until ) NOT IN (
SELECT id, MAX(valid_until )
FROM tableOne
GROUP BY id
)