求一个查询语句
比如一张学生成绩表中有三个字段,人名,数学成绩,语文成绩,要求查出数学成绩大于60,语文成绩小于60的所有人,并且要求查询结果先是数学成绩大于60的所有人,后面在是跟着语文成绩小于60的所有人的数据,也就是排在前面的人都是数学成绩大于60的人排在后面的都是语文成绩小于60的人.
如何查啊
------解决方案--------------------SQL> select *
2 from (
3 select 'aa ' as name,80 as mathsScore,50 as yuwenScore from dual
4 union all
5 select 'bb ' as name,40 as mathsScore,70 as yuwenScore from dual
6 union all
7 select 'cc ' as name,30 as mathsScore,70 as yuwenScore from dual
8 union all
9 select 'dd ' as name,80 as mathsScore,50 as yuwenScore from dual
10 union all
11 select 'ee ' as name,90 as mathsScore,35 as yuwenScore from dual
12 union all
13 select 'ff ' as name,10 as mathsScore,10 as yuwenScore from dual
14 )tt
15 where tt.mathsScore > 60
16 or tt.yuwenScore < 60
17 order by tt.mathsScore desc;
NAME MATHSSCORE YUWENSCORE
---- ---------- ----------
ee 90 35
aa 80 50
dd 80 50
ff 10 10