elect top (50) PaperId from TB_Paper where QuestionTypeId=1 and PaperDegree ='0' or PaperDegree='1' or PaperDegree='2' 我希望查询出来的结果集中这50条数据满足PaperDegree ='0'这个条件的占40% 满足PaperDegree='1'这个条件的 的占了 40% 满足PaperDegree='2'这个条件的占了20%数据量会比较大,我希望写的时候可以考虑到优化。
1 回答
白衣染霜花
TA贡献1796条经验 获得超10个赞
select top(20) PaperId from TB_Paper where QuestionTypeId=1 and PaperDegree ='0' union all
select top(20) PaperId from TB_Paper where QuestionTypeId=1 and PaperDegree ='1' union all
select top(10) PaperId from TB_Paper where QuestionTypeId=1 and PaperDegree ='2'
这样写,性能应该不至于太差
- 1 回答
- 0 关注
- 336 浏览
添加回答
举报
0/150
提交
取消