Stuart McLachlan
stuart at lexacorp.com.pg
Thu Apr 2 16:32:13 CDT 2009
You mean something like: Select Distinct, Int(PKID/1000000) as PKMegRange, Count(*) as Records from myTable Group By Int(PKID/1000000) Order by Int(PKID/1000000) On 2 Apr 2009 at 14:51, jwcolby wrote: > You could do that. But I need it to show me steps of X PKID. Perhaps > every 1 meg PK over 50 megs of records. ,,, > Charlotte Foust wrote: > > Maybe this is too simple, but wouldn't you just select Count(PKID) Where > > PKID less than or equal to PKID Z and Greater than or equal to PKID Y? > > -----Original Message----- ... > > I need to get a count of records in a PK range in SQL Server. For > > example I need to know that there are X addresses between PKID Y and > > PKID Z. > > > > Any idea how to do this in tsql?