我有一个查询,我试图获得过去6个月的帐户,以及他们有多少内容通过添加每个月,就像过去6个月可以有10个帐户,这10个帐户贡献了多少歌曲加在一起
我的查询类似于
SELECT COUNT(*) AS Quantity
FROM tblsong s
INNER JOIN tblaccount AS a ON a.AccountID = s.AccountID
where a.CreatedDateTime BETWEEN '2020-12-13'
AND '2021-06-13'发布于 2021-06-13 20:28:21
对于每个accont,您应该为AccountID使用一个group by
SELECT a.AccountID, COUNT(*) AS Quantity
FROM tblsong s
INNER JOIN tblaccount AS a ON a.AccountID = s.AccountID
where a.CreatedDateTime BETWEEN '2020-12-13'
AND '2021-06-13'
GROUP BY a.AccountIDhttps://stackoverflow.com/questions/67957863
复制相似问题