SELECT top 10 * FROM 专家抽取 WHERE 申报专业大专业 LIKE '%8%'
and name in (
SELECT name FROM 专家抽取 WHERE 申报专业大专业 LIKE '%8%'
group by name having count(name)=1
)
and department in(
SELECT name FROM 专家抽取 WHERE 申报专业大专业 LIKE '%8%'
group by department having count(department)<=2
)
order by NewID()
这不重复记录是指每次查询时都不重复呢还是一次查询中的数据不重复呢
select top 10 * from (select distinct 姓名,工作部门,申报专业大专业 from 专家抽取)temp WHERE 申报专业大专业 LIKE '%8%' order by NewID()