码迷,mamicode.com
首页 > 数据库 > 详细

数据库排序

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

标签:des   ar   sp   数据   bs   as   数据库   nbsp   信息   

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
--先筛选后排序

数据库排序

标签:des   ar   sp   数据   bs   as   数据库   nbsp   信息   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!