SELECT deposit.numberSuccessfulDeposits, count(distinct userid)
FROM deposit WHERE deposit.asOfDate between '2016-04-01 00:00:00' and '2016-04-03 23:59:59'
AND deposit.licenseeId = 1306
GROUP BY deposit.numberSuccessfulDeposits
樣本輸出集團通過總結變量
numberSuccessfulDeposits count(distinct userid)
0 228
1 878
2 90
3 37
4 17
然而,如果Bob在週二做出週一1個存3個存款,那麼這將計入這兩個「1」和「3」號的成功存款。
numberSuccessfulDeposits count(distinct userid)
0 ##
1 1
2 ##
3 1
4 ##
理想的情況下,它應該只對 「4」
numberSuccessfulDeposits count(distinct userid)
0 ##
1 ##
2 ##
3 ##
4 1
思考算什麼?
確定。卡米爾G.和巴爾瑪的建議都奏效。現在,我如何將3個以上的存款組合爲3+類別? – eddd83