mysql - 按查询分组时出现问题

标签 mysql

tod​​o:我按照c_id对一组数据进行分组,并取每组高度最大值的数据。 问题:2号图c_id=3等数据无法正确显示最大值。 enter image description here enter image description here

请问如何解决,谢谢。

最佳答案

select * 
  from student
 where (c_id, age,height) in ( Select c_id
                                    , max(age) age
                                    , max(height) as height 
                                 from student 
                                group 
                                   by c_id )

关于mysql - 按查询分组时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51591197/

相关文章:

php - 使用列的最大值更新在 mysql 中不起作用

mysql - ROR + MySql 查询 - 将单个值与单列中存在的逗号分隔值进行比较

Python 类型错误 : 'long' object is not subscriptable

mysql - 如何查询给定固定值的值的百分比

php - 在数据库中插入数据时出现问题

mysql - 将此查询分成批处理

mysql统计非空字段

php - 在 laravel blade Laravel 5.5 中找到许多列的总值

php - 如何使用 Web 表单使用数组将数据输入到 mysql 数据库?

mysql - MySQL中的性能改进和数据迁移策略