I have a table:
create table Transactions(Tid int,amt int)
With 5 rows:
insert into Transactions values(1, 100) insert into
With the 2012 SUM and OVER functions you can now nest sum and counts.
SUM
OVER
sum
counts
SELECT date, sum(count(DISTINCT unique_id)) OVER (ORDER BY date) AS total_per_date FROM dbo.table GROUP BY date