Results 1 to 5 of 5
  1. #1
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8

    Question Mulitple Group By in Query

    i have a table including fields for date and IP address (amongst other things). I am trying to create a query to pull out number of unique IP addresses for each day.

    can someone point me in the right direction?



    (i am using access 2010)

  2. #2
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Have you tried

    SELECT
    Date,
    IPAddress
    FROM
    myTable
    GROUP BY
    Date,
    IPAddress

    Alternatively,
    SELECT DISTINCT
    Date,
    IPAddress
    FROM
    myTable



    Thanks

  3. #3
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8
    Thanks recyan

    What i want is a count of distinct IPAddress for each day, not a list of distinct ips for each day. how do i do that?

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Sorry, Missed out the "Number of" in your original post.

    See if below gives some guidelines :
    Code:
    SELECT 
        qryDistinctDateIPAdrress.TheDate, 
        Count(qryDistinctDateIPAdrress.TheIPAddress) AS CountOfTheIPAddress
    FROM 
        (
            SELECT DISTINCT 
                myTable.TheDate, 
                myTable.TheIPAddress
            FROM 
                myTable
        )
        AS 
        qryDistinctDateIPAdrress
    GROUP BY 
        qryDistinctDateIPAdrress.TheDate;
    Am assuming, the Date doesn't have a time factor in it.

    Thanks

  5. #5
    rooster is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Apr 2012
    Posts
    8
    Thanks recyan, not so hard when you see it like that!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. query group by over another group by?
    By gap in forum Queries
    Replies: 2
    Last Post: 07-04-2011, 12:59 AM
  2. Replies: 1
    Last Post: 05-05-2011, 01:31 PM
  3. handling nulls in mulitple parameter query
    By haggisns in forum Queries
    Replies: 5
    Last Post: 10-14-2010, 02:09 PM
  4. Query Can it be Done? Mulitple finds
    By Canadiangal in forum Queries
    Replies: 3
    Last Post: 02-28-2010, 03:45 PM
  5. Condense Mulitple Records
    By jquickuk in forum Queries
    Replies: 1
    Last Post: 08-10-2009, 08:43 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums