Results 1 to 2 of 2
  1. #1
    kwalt is offline Novice
    Windows XP Access 2000
    Join Date
    Feb 2009
    Posts
    3

    using COUNT for multiple tables


    I have multiple tables in my database. Each table contains the same columns. I have a column called "sic_code_description" which describes what type of business the record is. Dentist, Doctor, Lawyer ect..

    I'm trying to count how many of these listings i have using multiple tables which ive broken down by county.

    My SQL Code looks like this:
    SELECT sic_code_description, COUNT(sic_code_description) AS
    "Number of Records"
    FROM hc_no_indv_docs_lawyers
    GROUP BY sic_code_description

    UNION SELECT sic_code_description, COUNT(sic_code_description) AS "Number of Records"
    FROM pc_no_indv_docs_lawyers
    GROUP BY sic_code_description;

    it works but my results look like this:

    Dentist 8
    Dentist 10
    Doctor 4
    Doctor 6

    i would like it to look like this:
    Dentist 18
    Doctor 10

    Any advice?

    Thanks.

  2. #2
    jya is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2007
    Location
    Chicagoland
    Posts
    109
    Perhaps not what you are looking for or the best way, but what about running two queries, one to compile the data using the Union query and the second to group by and count the descriptions?

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

Similar Threads

  1. Table related to multiple tables by single ID
    By MrTumnus in forum Access
    Replies: 1
    Last Post: 11-17-2009, 02:05 PM
  2. Query using count function
    By wasim_sono in forum Queries
    Replies: 0
    Last Post: 11-28-2007, 03:16 AM
  3. Replies: 1
    Last Post: 07-06-2007, 08:27 AM
  4. Replies: 1
    Last Post: 06-21-2007, 01:02 PM
  5. Count and recount for every new user per day?
    By valkyry in forum Queries
    Replies: 0
    Last Post: 07-24-2006, 03:37 PM

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