Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / October 2006

Tip: Looking for answers? Try searching our database.

Union Queries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
WMorsberger - 20 Oct 2006 13:55 GMT
I have two queries that I want to make into one query so that the information
can be pulled into a form.  I have read some information on the Union query
and was wondering if this would work for what I need to do.  Here are the two
queries that I have and that I need to try to merge into one query.  Can
someone please advise what I need to do from here?

SELECT [Correspondence Volumes].[DATE RECEIVED], [Correspondence
Volumes].[QUEUE ID], [Correspondence Queues].[QUEUE NAME], [Correspondence
Volumes].[VOLUME RECEIVED]
FROM [Correspondence Volumes] INNER JOIN [Correspondence Queues] ON
[Correspondence Volumes].[QUEUE ID] = [Correspondence Queues].ID
WHERE ((([Correspondence Volumes].[DATE RECEIVED])=[Enter Date]));

SELECT VOLUMES.[DATE RECEIVED], VOLUMES.[QUEUE ID], QUEUES.[QUEUE NAME],
VOLUMES.[VOLUME RECEIVED]
FROM QUEUES INNER JOIN VOLUMES ON QUEUES.ID = VOLUMES.[QUEUE ID]
WHERE (((VOLUMES.[DATE RECEIVED])=[Enter Date Received]));
kingston - 20 Oct 2006 14:45 GMT
Since your field sets match, open one of the queries in SQL design view and
paste the other query's SQL as such:

SELECT ...
UNION SELECT ...;

>I have two queries that I want to make into one query so that the information
>can be pulled into a form.  I have read some information on the Union query
[quoted text clipped - 13 lines]
>FROM QUEUES INNER JOIN VOLUMES ON QUEUES.ID = VOLUMES.[QUEUE ID]
>WHERE (((VOLUMES.[DATE RECEIVED])=[Enter Date Received]));
WMorsberger - 20 Oct 2006 14:55 GMT
Ok this is what I have - but it is asking me to Enter the Date received
twice.  Is there a way that I can have it ask only one but still only give me
the what I need for both queries?

SELECT [Correspondence Volumes].[DATE RECEIVED], [Correspondence
Volumes].[QUEUE ID], [Correspondence Queues].[QUEUE NAME], [Correspondence
Volumes].[VOLUME RECEIVED]
FROM [Correspondence Volumes] INNER JOIN [Correspondence Queues] ON
[Correspondence Volumes].[QUEUE ID]=[Correspondence Queues].ID
WHERE ((([Correspondence Volumes].[DATE RECEIVED])=[Enter Date]) AND
(([Correspondence Volumes].[VOLUME RECEIVED])>0));
UNION ALL SELECT VOLUMES.[DATE RECEIVED], VOLUMES.[QUEUE ID], QUEUES.[QUEUE
NAME], VOLUMES.[VOLUME RECEIVED]
FROM QUEUES INNER JOIN VOLUMES ON QUEUES.ID = VOLUMES.[QUEUE ID]
WHERE (((VOLUMES.[DATE RECEIVED])=[Enter Date Received]) AND
((VOLUMES.[VOLUME RECEIVED])>0));

> Since your field sets match, open one of the queries in SQL design view and
> paste the other query's SQL as such:
[quoted text clipped - 19 lines]
> >FROM QUEUES INNER JOIN VOLUMES ON QUEUES.ID = VOLUMES.[QUEUE ID]
> >WHERE (((VOLUMES.[DATE RECEIVED])=[Enter Date Received]));
kingston - 20 Oct 2006 15:06 GMT
Try making both parameters the same, i.e. [Enter Date].  If that doesn't work,
I think you may need to make a form to trigger the query based on a single
date control.

>Ok this is what I have - but it is asking me to Enter the Date received
>twice.  Is there a way that I can have it ask only one but still only give me
[quoted text clipped - 18 lines]
>> >FROM QUEUES INNER JOIN VOLUMES ON QUEUES.ID = VOLUMES.[QUEUE ID]
>> >WHERE (((VOLUMES.[DATE RECEIVED])=[Enter Date Received]));
WMorsberger - 20 Oct 2006 15:13 GMT
That worked when I made the parameters the same.  Thank you so much for your
help.

> Try making both parameters the same, i.e. [Enter Date].  If that doesn't work,
> I think you may need to make a form to trigger the query based on a single
[quoted text clipped - 22 lines]
> >> >FROM QUEUES INNER JOIN VOLUMES ON QUEUES.ID = VOLUMES.[QUEUE ID]
> >> >WHERE (((VOLUMES.[DATE RECEIVED])=[Enter Date Received]));
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.