DELETE FROM REPORTS_TASKS
WHERE EXISTS
(
选择* from (
选择最大(id ) id,
draft,go,IN_PROGRESS,DISCIPLINE,PROJECT_ID
FROM REPORTS_TASKS
where year_week='2021WK20 '
按组绘制,go,IN_PROGRESS,DISCIPLINE,PROJECT_ID
havingcount(1)1) t
where reports _ tasks.draft=t.draft
and reports _ tasks.in _ progress=t.in _ progress
AND REPORTS_TASKS.go=T.go
and reports _ tasks.discipline=t.discipline
如果要使用andreports_tasks.id=t.id--min函数,请在
and reports _ tasks.year _ week=' 2021 wk15 '
and reports _ tasks.project _ id=t.project _ id
)