Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    660

    Unanswered: how to put two query together.

    i have two queries, one called qry1
    SELECT Certificate.Country, Count(General.CertificationType) AS CountOfCertificationType
    FROM [General] INNER JOIN Certificate ON General.ID = Certificate.GeneralID
    GROUP BY Certificate.Country, General.Date
    HAVING (((General.Date)=[Enter the date]));


    another query calle qry2
    SELECT Apostille.Country, Count(General.CertificationType) AS CountOfCertificationType
    FROM [General] INNER JOIN Apostille ON General.ID = Apostille.GeneralID
    GROUP BY Apostille.Country, General.Date
    HAVING (((General.Date)=[ENTER THE DATE]));

    the two query results are not overlap. How can i put the two result together and sort by CountOfCertificationType.

    There are three tables, (General, Certification, Apostille).
    I try to join three table, but it didn't work,
    The General table has field (ID, CertificationType,Date)
    The Certification table has field (GeneralID, Country)
    The Apostille table has field (GeneralID, Coutry).

    How to join the table, so that i can have all the country and their countofCertification Type? Please ask me if i missed something. Any expert, please help. HELP,HELP, thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I beleive you are looking for a Union query. With a UNION it will take the results from several tables/queries and and show you all of the unique records from the tables/queries. For you I think something like:

    SELECT Country, CountOfCertificationType FROM qry1
    UNION
    SELECT Country, CountOfCertificationType FROM qry2

    To do this in Access, design a new query, don't add any tables, close the Show Table dialog box. Go directly to the SQL view and add the SQL I have then look at the reults. A couple of things about UNION, you always need the same columns in the same order when doing a UNION. If your columns don't match you will get an error, but if the are in the wrong order you will get some weird results with no error.

  3. #3
    Join Date
    Mar 2004
    Posts
    660
    Thanks, that is just what i want. Thank you very very much!

Posting Permissions

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