[AccessD] Count of records in PK range

jwcolby jwcolby at colbyconsulting.com
Thu Apr 2 16:44:25 CDT 2009


You da man (again).  Why distinct?

John W. Colby
www.ColbyConsulting.com


Stuart McLachlan wrote:
> 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?
> 



More information about the AccessD mailing list