มีค่าหัวเพียงอันเดียว) ไม่จำเป็นต้องใช้ทุกตาราง
s with only one bounty).It is not neccessary to use all the tables.
 PostNoticeTypes:  Id [ number]  ClassId [ number]  Name [ text]  Body [ text]  IsHidden [ boolean]  Predefined [ boolean]  PostNoticeDurationId [ number] 
WITH bounties_cte AS (SELECT SUM(v.BountyAmount) AS bntsum, COUNT(v.BountyAmount) AS bntnum, p.Id AS pid, p.ViewCount AS vc FROM Posts AS p JOIN Votes AS v ON v.PostId = p.Id WHERE v.VoteTypeId = 8 GROUP BY p.Id, p.ViewCount) SELECT bntsum AS "total_bounties", AVG(vc) AS "average_viewcount" FROM bounties_cte WHERE bntnum = 1 GROUP BY bntsum ORDER BY bntsum