Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sql error in Union qry

Status
Not open for further replies.

drussum

Programmer
Jan 31, 2002
38
US
I Have one qry sorting records by the number "1".
I have a second qry sorting records by "2".
I have a third qry that is a "Left Join" (all records from qry 1 and those matching in qry2)
I have a forth qry that is a "right Join" (all records from qry 2 and those matching in qry1) then......
I have a union qry calling on all records from qry1 and all records from qry 2.

The Union qry works fine and brings all records together.
The problem I have is that I need to display a subset that looks similar to this:

[January actual] [January Budget] [January Variance]
(Qry1) (Qry2) (Qry1 - Qry2)

I need this to show for all the months of the year.

I am able to get this using the union qry except that it displays it as
[January actual] [January Budget] [January Variance]
(Qry1) (Qry2) (Qry1 - Qry2)
for one row (all the "Ones"(Qry1) then the same again on a second row for all the "Two's" (qry2). I need the script to use in the union qry to select only the Ones in the qry1 and only the twos in the qry2 not both ones and two from both qrys. what is the select statement to specify which field and the specific value in that field?



 
I think the lack of reply might be due to the fact that what you wrote is confusing to understand without the DB in front of me. It may be easier to understand if you avoid using numbers for query and variable names (even just for the explanation).

I would love to help you but honestly you lost me. X-) Try to post a rephrased question and maybe I or someone else will be able help.

Sorry,

Jude
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top