首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

明天交公 SQL语句

2012-02-10 
明天交公求一个SQL语句我有一个表字段是(学号,课程号,课程名,学分,考试成绩,考试学年)这个表是用课程号和

明天交公 求一个SQL语句
我有一个表   字段是   (学号,课程号,课程名,学分   ,考试成绩,考试学年)
这个表是用课程号和   考试学年   两个字段确定的主建

我现在   想在   (select   *   from   code_kcm   where   xh= '学号 '   order   by   考试学年)   里提出前20纪录和后20条纪录  
请问SQL语句怎么写

[解决办法]
select top 20 * from code_kcm where xh= '瀛﹀彿 ' order by 鑰冭瘯瀛﹀勾
union all
select top 20 * from code_kcm where xh= '瀛﹀彿 ' order by 鑰冭瘯瀛﹀勾 DESC
[解决办法]
select top 20 * from code_kcm where xh= '学号 ' order by 考试学年
union all
select top 20 * from code_kcm where xh= '学号 ' order by 考试学年 DESC
[解决办法]
--前一半的数据
select top 50 percent * from code_kcm where xh= '学号 ' order by 考试学年


--后一半的数据
select top 50 percent * from code_kcm where xh= '学号 ' order by 考试学年 desc
[解决办法]
select top 20 * from code_kcm where xh= '学号 ' order by 考试学年 asc
union all
select top 20 * from code_kcm where xh= '学号 ' order by 考试学年 desc
[解决办法]
--前一半的数据
select top 20 * from code_kcm where xh= '学号 ' order by 考试学年


--后一半的数据
select top 20 * from code_kcm where xh= '学号 ' order by 考试学年 desc

热点排行