mysql order by内排序
2016-04-20 15:35
337 查看
目前还没找到完美的解决方案
https://dev.mysql.com/doc/refman/5.6/en/example-maximum-column-group-row.html http://stackoverflow.com/questions/1066453/mysql-group-by-and-order-by https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
这个貌似解决了,还得再理解一下。。。
http://www.educity.cn/wenda/404337.html
--三、按name分组取第一次出现的行所在的数据。
select a.*from tb a where val = (selecttop1 val from tb where name = a.name) orderby a.name
https://dev.mysql.com/doc/refman/5.6/en/example-maximum-column-group-row.html http://stackoverflow.com/questions/1066453/mysql-group-by-and-order-by https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
这个貌似解决了,还得再理解一下。。。
http://www.educity.cn/wenda/404337.html
--三、按name分组取第一次出现的行所在的数据。
select a.*from tb a where val = (selecttop1 val from tb where name = a.name) orderby a.name
相关文章推荐
- mysql workbench导出建表语句 unknown variable 'delayed-insert=FALSE'的错误解决
- mysql 生成排名字段
- Mysql主从配置,实现读写分离
- mysql (master/slave)复制原理及配置
- Access denied for user 'mysql用户名'@'主机或IP' (using password: YES)'
- mysql存储过程
- MYSQL导入导出sql文件简析
- mysqli 预处理详解
- 解决MySQL Sending data导致查询很慢问题的方法与思路
- MySQL(一)
- 如何恢复MySQL主从数据一致性
- mysql不能启动:Unit mysql.service failed to load: No such file or directory的解决办法
- yum安装mysql,迅速上手
- jsp-MySQL连接池
- host ... is not allowed to connect to this MySql server 开放mysql远程连接
- MySQL 读写分离介绍及搭建
- MySQL 读写分离介绍及搭建
- 快速实现MySQL的部署以及一机多实例部署
- 查询分析mysqldumpslow
- MySQL的root密码忘记怎么办 修改root密码的方式