Select date, count(*) as volume
from table
group by date
order by 2
or
order by count
or
order by count(*)
订单依据不适用于上述任何选项。我想要按量订购
你能帮忙吗?答案 0 :(得分:0)
我刚刚在Netezza上尝试了所有三个查询,其中只有两个正在运行。
- 工作正常
SELECT DATE, COUNT(*) AS VOLUME
FROM TABLE
GROUP BY DATE
ORDER BY 2;
- 工作正常
SELECT DATE, COUNT(*) AS VOLUME
FROM TABLE
GROUP BY DATE
ORDER BY COUNT(*)
- 这不起作用,因为select by子句中不存在Order by Column。
SELECT DATE, COUNT(*) AS VOLUME
FROM TABLE
GROUP BY DATE
ORDER BY COUNT;