2010-02-11 89 views

回答

5

我想你想過濾組使用HAVING COUNT(*)而不是WHERE

SELECT Id, QId, UName, Ans, Date, Count(*) * 10 as Total 
FROM question 
GROUP BY UName 
HAVING Count(*) 

如果你有什麼要由元素數量排序組,然後使用ORDER BY

SELECT Id, QId, UName, Ans, Date, Count(*) * 10 as Total 
FROM question 
GROUP BY UName 
ORDER BY Count(*) DESC 
+2

WHERE過濾器行,HAVING過濾器組 – 2010-02-11 17:00:29

+0

@KM:感謝您的評論 – 2010-02-11 17:05:56