Hey everyone,
Im trying to do some math in a query in order to limit my asp work.
What im trying to come up with is the top 20% of file owners based on a table that contains individual records of every file on a server.
THis table contains Owner (file owner), FileSize, and other records i dont need for this query.
I need for results any person who's sum(Filesize) is greater than 20% of the sum(all filesizes) grouped by owner. For them i need their total filesize, count of their files, and their owner name
I was trying this query but it wasnt working.
Select Count(*), Sum(FileSize) as Total, Owner,
completesum=(select Sum(FileSize) from FileScanner.dbo.FileInformation)
from FileScanner.dbo.FileInformation
where Total/completesum > .2
group by owner
Thanks
Im trying to do some math in a query in order to limit my asp work.
What im trying to come up with is the top 20% of file owners based on a table that contains individual records of every file on a server.
THis table contains Owner (file owner), FileSize, and other records i dont need for this query.
I need for results any person who's sum(Filesize) is greater than 20% of the sum(all filesizes) grouped by owner. For them i need their total filesize, count of their files, and their owner name
I was trying this query but it wasnt working.
Select Count(*), Sum(FileSize) as Total, Owner,
completesum=(select Sum(FileSize) from FileScanner.dbo.FileInformation)
from FileScanner.dbo.FileInformation
where Total/completesum > .2
group by owner
Thanks