【发布时间】:2017-05-05 14:22:41
【问题描述】:
width 和 height 列是 smallint(6)。
我想从width 中选择distinct 值,按width asc 排序,然后按height asc 排序。
这是我的尝试:
- $sql = "select * from banners group by width order by width, height asc";
- $sql = "select * from banners group by width order by width asc, height asc";
- $sql = "select * from banners group by width order by width asc, height";
没有任何作用。选择按宽度排序,但按高度不正确。
【问题讨论】:
-
你能展示一些示例数据吗?
-
请期待输出
-
这个ans可以帮助你stackoverflow.com/a/42719808/2286537
-
为什么是
group by width? -
@Forward,因为我只需要来自
width的不同值。