By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,224 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,224 IT Pros & Developers. It's quick & easy.

Union Query Problem

P: n/a
I need to make a union query that returns the results of 2 queries
without combining any fields.
Let me give you an example

Query1
Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 10 0 Electrical Eng.

Query2
Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 0 10 Mech Eng

I want the query to show both records but it tries to put them
together if there is no budget. The query returns the following:

Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 10 10 Mech Eng

Obviously this doesn't work because the budget was for a Elec Eng and
not a Mech eng.
Any help would be great...
Here is my SQL code...

SELECT [workorder],[sequence],[budget],[sumofhrs],[jobcode],[link],[sequence
description],[job category2],[employee category]

from [allbudgetlabor]

UNION select ALL [wonumber],[sequence],[budget],[sumofhrs],[job],[link],[sequence
description],[job category2],[employee category]

from [alllaborbudget];
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"turtle" <ko****@vistacontrols.com> wrote in message
news:58**************************@posting.google.c om...
I need to make a union query that returns the results of 2 queries
without combining any fields.
Let me give you an example

Query1
Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 10 0 Electrical Eng.

Query2
Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 0 10 Mech Eng

I want the query to show both records but it tries to put them
together if there is no budget. The query returns the following:

Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 10 10 Mech Eng

Obviously this doesn't work because the budget was for a Elec Eng and
not a Mech eng.
Any help would be great...
Here is my SQL code...

try UNION ALL instead of UNION

Nov 12 '05 #2

P: n/a
John,
Thanks, but I did try union all and did not get all the records... it
seemed to combine the data.

"John Winterbottom" <as******@hotmail.com> wrote in message news:<2h************@uni-berlin.de>...
"turtle" <ko****@vistacontrols.com> wrote in message
news:58**************************@posting.google.c om...
I need to make a union query that returns the results of 2 queries
without combining any fields.
Let me give you an example

Query1
Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 10 0 Electrical Eng.

Query2
Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 0 10 Mech Eng

I want the query to show both records but it tries to put them
together if there is no budget. The query returns the following:

Job WorkOrder Sequence Budget Actuals Employee_Category
1 A000 1000 10 10 Mech Eng

Obviously this doesn't work because the budget was for a Elec Eng and
not a Mech eng.
Any help would be great...
Here is my SQL code...

try UNION ALL instead of UNION

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.