[Select] the results of 2 queries

G

Guest

I have two queries that produce lists of "Course Speakers" and "Course
Registrations". I want to combine the lists to produce a list of all
attending my course whether they are an speaker OR paying participant
(registrations)

The tables & important fields i am using are:

[Everyone] = with "Everyone ID" pk, "First name" , "Last name"
[Training Course] = "Course ID" pk (My criteria for the on both select
queries)
[Registrations] = "Reg ID" pk, "Everyone ID" fk, "Course ID" fk
[Speakers] = "Speaker ID" pk, "Everyone ID" fk, "Course ID" fk

The two queries naturally are:
Course_Speakers (which speakers on which course ie.. Everyone, Training
Course, Speakers)
Course_Registrations (the registered participants on which course ie..
Everyone, Training Course, Registrations)

How do i write a query to produce a list of Speakers OR Registrations with
the criteria being the Training Course
 
B

Baz

You need a UNION query e.g.

(SELECT * FROM Course_Speakers) UNION (SELECT * FROM Course_Registrations)

Note that, although the two queries don't need return identical field names,
they do need to return the same number of fields, and in the same positions
in the SELECT list with respect to data types.

Also, you can't do this in query design view, you'll need to type it into
the SQL window.
 
G

Guest

That works great thanks.
I'm surprised that the query deigner can't create some types of query.. i
didn't know that, although it makes sense that it can't do a Union query

Chris

Baz said:
You need a UNION query e.g.

(SELECT * FROM Course_Speakers) UNION (SELECT * FROM Course_Registrations)

Note that, although the two queries don't need return identical field names,
they do need to return the same number of fields, and in the same positions
in the SELECT list with respect to data types.

Also, you can't do this in query design view, you'll need to type it into
the SQL window.

Engels said:
I have two queries that produce lists of "Course Speakers" and "Course
Registrations". I want to combine the lists to produce a list of all
attending my course whether they are an speaker OR paying participant
(registrations)

The tables & important fields i am using are:

[Everyone] = with "Everyone ID" pk, "First name" , "Last name"
[Training Course] = "Course ID" pk (My criteria for the on both select
queries)
[Registrations] = "Reg ID" pk, "Everyone ID" fk, "Course ID" fk
[Speakers] = "Speaker ID" pk, "Everyone ID" fk, "Course ID" fk

The two queries naturally are:
Course_Speakers (which speakers on which course ie.. Everyone, Training
Course, Speakers)
Course_Registrations (the registered participants on which course ie..
Everyone, Training Course, Registrations)

How do i write a query to produce a list of Speakers OR Registrations with
the criteria being the Training Course
 

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

Top