本期我的表格有三列:播放器,团队和Date_Played。SQL与群组的差异计数
Player Team Date_Played
John Smith New York 2/25/2014
Joe Smith New York 2/25/2014
Steve Johnson New York 2/25/2014
Steph Curry Orlando 2/25/2014
Frank Anthony Orlando 2/26/2014
Brian Smith New York 2/26/2014
Steve Johnson New York 2/27/2014
Steph Curry New York 2/28/2014
我知道如何获得的不同的团队名称或播放日期的名单,但我正在寻找的是一个查询,将通过团队组和计数不同的团队&日期组合的数量。所以输出应该是这样的:
Team Count
New York 4
Orlando 2
到目前为止,我有:
SELECT DISTINCT Tm, Count(Date_Played) AS Count
FROM NBAGameLog
GROUP BY NBAGameLog.[Tm];
但是这给了我的按日期分组的记录总量。
这样做,谢谢! – fullOfQuestions