我需要从数据库中删除除前两个选定日期以外的所有日期:
SELECT DateColumn FROM Table GROUP BY date(DateColumn) ORDER BY DateColumn DESC
我想在一个查询中删除除前两个日期以外的所有日期。
delete from table where DateColumn not in( SELECT DateColumn FROM Table GROUP BY date(DateColumn) ORDER BY DateColumn DESC LIMIT 2)