这条SQL语句是什么意思

来源:百度知道 编辑:UC知道 时间:2024/05/14 10:22:46
"delete from Table1 where id=any(select a.id from inputdata a,(SELECT testno, testitem From inputdata GROUP BY testno, testitem HAVING min(isfinished)=1) b where a.testno=b.testno and a.testitem=b.testitem)"

希望能详细解释一下这条语句,尤其是a 和b 是怎么回事,谢啦!

删除子查询中和id相等的值 。a是表inputdata的别名,b是(SELECT testno, testitem From inputdata GROUP BY testno, testitem HAVING min(isfinished)=1) 查询结果起的别名

delete from Table1--删除 表1
where id=any--ID与下面的任何一个ID相同时
(select a.id --查询ID
from inputdata a,--从表inputdata 并给inputdata 起个别名叫a
(SELECT testno, testitem --查询这两个字段。
From inputdata GROUP BY testno, testitem --分组
HAVING min(isfinished)=1--筛选分组
) b --括号内为子查询,给该子查询起个别名叫b
where a.testno=b.testno and a.testitem=b.testitem-- A.ID的查询条件)"