Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Group by ID get count of records in each million range

$
0
0

I have a table that has 72m records. The clientID column highest number is 197m. So I want to get a count of records per million. So the first record would return how many records there were with a clientid between 0 and 1,000,000. The second record would be a count of records with a clientid between 1,000,001 and 2,000,000 etc etc. Up to 197m. It would look something like below. Any help on how to do this?

1m 320030

2m 23232

3m 482938

5m 2380

6m 23838

7m 8392

Something like that.


Alan


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>