Results 1 to 4 of 4

Unique values across multiple columns

This is a discussion on Unique values across multiple columns within the Microsoft Access forums, part of the Question Forums category; Hi all, Long time poster in the excel forum, infrequent poster in this forum because I rarely have a need ...

  1. #1
    Ody
    Ody is offline
    Board Regular
    Join Date
    Oct 2010
    Location
    Flabcore 6
    Posts
    212

    Default Unique values across multiple columns

    Hi all,

    Long time poster in the excel forum, infrequent poster in this forum because I rarely have a need to use Access.

    Any way, I have a data set I can't quite manipulate in excel (2003) the way I want to. When I pull the info into Access I can pull distinct records from my customer data (SELECT DISTINCT data.Account FROM data)and distinct records from my acct data (SELECT DISTINCT data.CUSTOMER_NAME FROM data).

    What I'm having a hard time doing is querying the count of unique customers that occur on each unique account number.

    Any thoughts? I haven't used Access in a while and I'm a little rusty.

    Thanks for any help!

  2. #2
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    27,363

    Default Re: Unique values across multiple columns

    Do you mean like this?
    Code:
    SELECT DISTINCT data.Account, data.CUSTOMER_NAME
    FROM data;
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

  3. #3
    Ody
    Ody is offline
    Board Regular
    Join Date
    Oct 2010
    Location
    Flabcore 6
    Posts
    212

    Default Re: Unique values across multiple columns

    Thanks for the reply Joe4,

    I tried that combination but it didn't provide me with an accurate answer.

    From what research (i.e. googling) I've done it doesn't appear that access supports the Count(Distinct) aggregate so I'm not sure how to write a query that will give me the unique customers per unique account.

    Make sense?

  4. #4
    MrExcel MVP
    Moderator
    Joe4's Avatar
    Join Date
    Aug 2002
    Posts
    27,363

    Default Re: Unique values across multiple columns

    If I understand what you are looking for correctly, I think you can correct this in two steps.

    1. Create a DISTINCT select query to weed out your duplicates.

    2. Create a second query, based on the first, and make this an Aggregate (Totals) queries that Groups By Customers and Counts the accounts.
    TIPS FOR FINDING EXCEL SOLUTIONS
    1. Use the built-in Help that comes with Excel/Access
    2. Use the Search functionality on this board
    3. A lot of VBA code can be acquired by using the Macro Recorder.

    "Give a man a fish, feed him for a day. Teach a man to fish, feed him for life!"

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com