I'm having some trouble with a query I want to write.
I have a table consists of files and their size in bytes. It looks like this:
FileUrl | FileSize
------------------
xyz.docx | 2794496
qwe.ppt | 655360
asd.pdf | 1388782
...
...
What I want is finding the number of files, % of total file count and % of total file size based on different size groups that I will define. So it should like this:
Size Category | Number of Files | % of Total File Count | ½ of Total File Size
------------------------------------------------------------------------------
0-1 MB | 235 | 80% | 20%
1-10 MB | 57 | 20% | 80%
10-50 MB
...
...
What is the best way to create such groups and then finding those percentages? I can't come up with a solution and my online searches didn't help at all.
Thank you in advance