Results 1 to 4 of 4
  1. #1
    mkallover is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    25

    Count values across multiple columns

    I'd like to do a query where I count the number of occurrences of error codes that are assigned to a claim. However, on each claim there can be up to 10 error codes that are in columns "err_cde_01, err_cde_02, etc..."



    The first thing I would like to do is count the number of occurrences of each error code (a three digit number) across all 10 columns. Is there a good way to do that outside of summing 10 different queries?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Is it too late to fix the design? A normalized design would have the error codes in a one-to-many related table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    mkallover is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2010
    Posts
    25
    Unfortunately no. I'm working with an extract file based on data pulled from our mainframe so I don't think they'd be keen on redoing their mainframe tables for little old me!

    For now I'm using a union query to pull in the 10 fields. I just didn't know if there was a better alternative.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No, I suspect you're doing it the best way. You'll probably use the UNION for other things anyway, to essentially normalize the data.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. 3 values in 1 Column - Get Count of Each Value
    By Ghoztrider in forum Queries
    Replies: 1
    Last Post: 01-09-2012, 03:26 PM
  2. Count() and Null Values
    By jpvonhemel in forum Queries
    Replies: 4
    Last Post: 10-21-2011, 03:37 AM
  3. Count Field Values.
    By Cined in forum Access
    Replies: 3
    Last Post: 03-03-2011, 03:21 AM
  4. Replies: 1
    Last Post: 01-24-2011, 03:03 PM
  5. Count of Unique Values
    By vsmk in forum Queries
    Replies: 2
    Last Post: 03-14-2010, 12:07 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