mysql字段排序语句_数据库字段排序的SQL语句
发布时间:2022-09-22 14:32:36 所属栏目:MySql教程 来源:
导读: 简明现代魔法 -> 数据库技术 -> 数据库字段排序的SQL语句
数据库字段排序的SQL语句
2009-09-17
将字段依次写在order by 后面即可 , 中间用逗号隔开。
select * from 表 order b
数据库字段排序的SQL语句
2009-09-17
将字段依次写在order by 后面即可 , 中间用逗号隔开。
select * from 表 order b
简明现代魔法 -> 数据库技术 -> 数据库字段排序的SQL语句 数据库字段排序的SQL语句 2009-09-17 将字段依次写在order by 后面即可 , 中间用逗号隔开。 select * from 表 order by time , name select * from 表 order by time asc , name asc select * from 表 order by time desc , name desc select * from 表 order by time asc , name desc select * from 表 order by time desc , name asc (注: asc 表示升序 , desc表示降序 , 未明确写明排序方式时默认是升序) 与之类似的语法是 group by , 按多个字段分组时 , 也是依次将多个字段写在group by 的后面 , 并用逗号隔开 , 范例如下: select time , name , sum(*) from 表 group by time , name 将数据库Datetime字段按时间排序 数据表article里有好几个字段,其中一个是article_date,其数据类型是datetimemysql排序,将记录按datetime排序,只要使用以下SQL语句即可。 $query=mysql_query("select * from article order by article_date"); (编辑:财气旺网 - 财气网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
站长推荐