2

我想从计数结果中得到 AVG。

SELECT labelname AS Record_Labels, COUNT(title) AS Number_of_CDs_Released FROM CD
JOIN RecordLabel ON labelname = released_by
GROUP BY labelname;             

我试过这样做:AVG(COUNT(title)),但它没有用。有谁可以帮我离开这里吗?

4

1 回答 1

4

您可以使用嵌套查询来执行此操作:

select avg(Number_of_CDs_Released) from
(SELECT labelname AS Record_Labels, COUNT(title) AS Number_of_CDs_Released FROM CD
JOIN RecordLabel ON labelname = released_by
GROUP BY labelname) nested;
于 2012-11-25T21:50:46.833 回答