Microsoft Access按汇总排序?

时间:2013-11-05 01:25:48

标签: sql ms-access ms-access-2010

有没有办法按开放任务的数量排序?

SELECT Tasks.ClientName, Count(*) AS OpenTaskCount
FROM Tasks
WHERE (((Tasks.Completed)=False))
GROUP BY Tasks.ClientName
ORDER BY OpenTaskCount DESC;

当我尝试这个时,它会在GUI中提示输入OpenTaskCount。

2 个答案:

答案 0 :(得分:2)

试试这个:

SELECT Tasks.ClientName, Count(*) AS OpenTaskCount
FROM Tasks
WHERE (((Tasks.Completed)=False))
GROUP BY Tasks.ClientName
ORDER BY COUNT(*) DESC;

答案 1 :(得分:2)

或者:

SELECT Tasks.ClientName, Count(*) AS OpenTaskCount
FROM Tasks
WHERE (((Tasks.Completed)=False))
GROUP BY Tasks.ClientName
ORDER BY Count(*) DESC;

SELECT Tasks.ClientName, Count(*) AS OpenTaskCount
FROM Tasks
WHERE (((Tasks.Completed)=False))
GROUP BY Tasks.ClientName
ORDER BY 2 DESC;

应该有用。