【发布时间】:2020-02-02 06:35:36
【问题描述】:
我正在尝试根据修改后的日期查找不同的订单。我要排序,找到最新修改的订单。
我尝试像在 postgreSQL 中那样做。
select distinct on (orders) * from the table;
但这会在 mariaDB 的情况下引发错误
Orders Modified Date
------ ---------------
23031185 2019-09-24 19:36:51
23031185 2019-09-24 22:01:57
23031185 2019-09-24 19:32:28
23031185 2019-09-24 19:33:25
23031185 2019-09-24 19:33:18
The expected output should be the latest one
Orders Modified Date
------ ---------------
23031185 2019-09-24 22:01:57
我还有其他专栏。我需要根据订单列与所有其他列获取所有不同的行。
【问题讨论】:
-
查看 [groupwise-maximum] 标签。
标签: sql mariadb groupwise-maximum