首页 > 数据库技术 > 详细

数据库排序

时间:2014-11-25 10:24:54      阅读:293      评论:0      收藏:0      [点我收藏+]

use mydb
--排序
select *from Category  order by Ids asc
--order排序的意思
--asc 升序
select *from Category  order by Ids desc
--desc 降序
select *from Category order by parent,ids
--首先遵循第一排序原则 默认升序
select *from Category order by parent desc,ids desc
--根据先后顺序排列降序
select parent from  Category group by Parent
select code from Category  where Parent =‘m‘
--group 分组
--distinct去重,去重复显示
select distinct parent from Category
--前多少条数据
select *from Category --查询全部信息
select top 5 *from Category
--查询前5条信息
select top 5 *from Category order by Ids
--排序查询前5条信息
select top 5 *from Category where Ids >900 and Ids <950 order by
--先筛选后排序

数据库排序

原文:http://www.cnblogs.com/yangyue/p/4120183.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!