标签:group by bre having group row select and dem begin
SET ROWCOUNT 1
WHILE 1=1
BEGIN
DELETE FROM [dbo].[Demo]
WHERE [Id] IN
(
select d1.Id
from [Demo] d1
where exists (select 1 from [Demo] d2 where d1.[EId]=d2.[EId] and d1.[RId]=d2.[RId] group by d2.[EId],d2.[RId] having count(1)>1)
)
IF @@ROWCOUNT=0
BREAK
END
SET ROWCOUNT 0
标签:group by bre having group row select and dem begin
原文地址:http://www.cnblogs.com/zhtbk/p/6727240.html