How do I remove duplicate enteries from a query for use in a combo box?

  • Thread starter Thread starter Jamie Risk
  • Start date Start date
J

Jamie Risk

I have a query constructed by using the wizard:

SELECT
[Politicians].District_ID,
[Politicians].Pol_ID,
[Politicians].Name,
[Professionals].Prof_ID,
[Professionals].Name
FROM
( Districts
INNER JOIN
[Politicians] ON Districts.District_ID = [Politicians].District_ID
)
INNER JOIN
[Profesionals] ON Districts.District_ID = [Professionals].District_ID;


Profesionals to Politicians is a many to one relationship (via the
District_ID).

I'd like to modify the query to essentially get a list of Districts
(Districts.Distric_ID) where there is a politician and at least one
professional.
 
Hi Jamie,

You can either use this query in another query, or you can modify it to get
what you want. Either way, there are two methods to do what you want. You
can either GROUP BY or you can SELECT DISTINCT - assuming this Query is
called Query1:

SELECT District_ID FROM Query1 GROUP BY District_ID

or

SELECT DISTINCT District_ID FROM Query1

The former shows up better in the Design view of the query, whereas the
latter doesn't really.

Note that I'm assuming the Query1 gives you the right set of Districts in
the first place - I haven't tried to analyse whether it's actually giving
you what you describe (one politician and at least one professional)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top