27,579
社区成员
发帖
与我相关
我的任务
分享
ID GroupID Name abc
----------- ----------- ------------------------------
1 0 AD
2 0 ASD
3 1 aa
4 1 asdfasdfa
5 0 asdf
6 0 asdfasdf
7 0 asdfasdfasdf
8 6 a
9 6 a
10 4 ASDF
11 7 a
12 7 a
(12 行受影响)
;with f as
(
select * from tb where id='xx'
union all
select a.* from tb as a inner join f as b on a.id=b.groupid
)
delete ftom tb as t where exists(select 1 from f where id=t.id)