Forum Discussion
jawster
May 19, 2023Copper Contributor
SQL Server Analytical functions - OVER (PARTTION)
I am using the below query to attempt to create a cumulative total of each grouping for each COUNT in the last column. The below is not working or me. If you run the below you will see it.
SELECT
DB_NAME(dbid) as DBName,
COUNT(dbid) as NumberOfConnections,
loginame as LoginName,
SUM(count(dbid)) OVER (PARTITION BY sum(dbid)
ORDER BY sum(dbid))
AS CumulativeTotal -- Wrong
FROM
sys.sysprocesses
WHERE
dbid > 0
GROUP BY
dbid, loginame
order by 2 desc,3;
- olafhelperBronze Contributor
The below is not working or me.jawster , "not working" means what in detail?
>
If you run the below you will see it.
No, I don't see it.
That's really to less on information.
Please post table design as DDL, some sample data as DML statement and the expected result.