Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

PLEASE HELP WITH THIS!

hertsunihertsuni Posts: 1Member
I am trying to create a query in ms access which is a union.
The query counts how many applicants come from each town. However when I run the query it shows how many applicants come from each town in one row however you cannot tell which towns the applicants come from, all you get is a list of numbers.

Here is the query:

SELECT Count(tblApplicant.Town) AS No_Of_Applicants
FROM tblApplicant
WHERE (((tblApplicant.Town)='Buckinghamshire'));
UNION ALL
SELECT Count(tblApplicant.Town) AS No_Of_Applicants
FROM tblApplicant
WHERE (((tblApplicant.Town)='Essex'));
UNION ALL
SELECT Count(tblApplicant.Town) AS No_Of_Applicants
FROM tblApplicant
WHERE (((tblApplicant.Town)='Hertfordshire'));

Is there any way that I can get the number of applicants under the headings of the towns.
Please help
Thanks in advance.

Comments

  • SequinSequin Posts: 5Member
    Your query doesn't need to be a union query

    SELECT tblApplicant.Town, Count(tblApplicant.Town) AS No_Of_Applicants
    FROM tblApplicant
    WHERE tblApplicant.Town IN('Buckinghamshire','Essex''Hertfordshire')
    GROUP BY tblApplicant.Town;
Sign In or Register to comment.