先按时间排序,再按姓名排序 sql语句

来源:互联网 发布:ubuntu下安装exe 编辑:程序博客网 时间:2024/05/20 04:12
将字段依次写在order by 后面即可 , 中间用逗号隔开select * from 表 order by time , nameselect * from 表 order by time asc , name ascselect * from 表 order by time desc , name descselect * from 表 order by time asc , name descselect * from 表 order by time desc , name asc(注:  asc 表示升序 , desc表示降序 , 未明确写明排序方式时默认是升序  )与之类似的语法是 group by , 按多个字段分组时 , 也是依次将多个字段写在group by 的后面 , 并用逗号隔开 , 范例如下:select time , name , sum(*) from 表 group by time , name
原创粉丝点击