select distinct * from TableName as out
where exists(select * from
(select DiaID from TableName group by DiaID having count(*) > 1) as b
where DiaID = out.DiaID)
select * from TableName as out
where exists(select * from
(select DiaID from TableName group by DiaID having count(*) > 1) as b
where DiaID = out.DiaID)
[/Quote]
Diary 和 Advertisement 是关联的 DiaID 是 Diary表的 AdverTitle是Advertisement 表的
select * from TableName as out
where exists(select * from
(select DiaID from TableName group by DiaID having count(*) > 1) as b
where DiaID = out.DiaID)