日期:2014-05-17 浏览次数:20444 次
create table #tb(id int, names varchar(10))
insert into #tb
select 1,'笔记本'
union all select 2,'作业本'
union all select 3,'课本'
union all select 4,'笔记本'
union all select 5,'作业本'
union all select 6,'笔记本'
select *
from #tb
where names not in(select names from #tb group by names having count(*)>=3)
drop table #tb
/*
id names
------------------------
2 作业本
3 课本
5 作业本
*/