Count Query

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

Hi All,

I have two fields in a table with thousand of records of IP addresses and I
need to count the number of occurrences where the IP in field1 and the IP
address in field2 are the same.

I'm probably missing something obvious but I can't see how to do this. Can
anyone help please.

Ta.
Bill.
 
In the criteria for Field 2 put

[your table name].[field1]

It will filter the records for where they are the same.
 
The most straight forward way to get just the count would be:

SELECT COUNT([IP1]) as MatchCount
FROM [YourTable]
WHERE [IP1] = [IP2]

In the query grid
-- Open a new query
-- Select your table
-- Add IP1 to the query
-- Add IP1 to the query again
-- Select View: Totals from the menu
-- Change 1st group by to Count
-- Change second group by to Where
-- enter [Ip2] as the criteria for the second field


'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Back
Top