当我在那里运行以下查询时没有错误。请注意查询上的DESC。
select date(created) date,
count(distinct some_id) subsccount,
type
from sometable
group by date,type DESC
limit 5
答案 0 :(得分:2)
正如select syntax上的MySQL文档所说:
MySQL扩展了GROUP BY子句,以便您也可以指定ASC和 在子句中命名的列之后的DESC:
SELECT a, COUNT(b) FROM test_table GROUP BY a DESC;