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

Connecting data from two queries

P: 34
Hi,

I have created two basic queries which both output a two column table, one (query A) has the columns 'Queue' and 'Errors' and the other (query B) has the columns 'Queue' and 'Correct'.

I need to write a query which combines the data from both to output a table with 3 columns 'Queue', 'Errors' and 'Correct'. However there are queues in query A which are not in query B and visa-versa.

How can i combine these together so that if a 'queue' has data in 'errors' but nothing in 'correct' it outputs a '0' in the 'correct' field and similarly if a 'queue' has data in 'correct' but nothing in 'errors' it outputs a '0' in the 'errors' field.

Help would be appreciated,im using access '97.
Jun 5 '07 #1
Share this Question
Share on Google+
2 Replies

JConsulting
Expert 100+
P: 603
Hi,

I have created two basic queries which both output a two column table, one (query A) has the columns 'Queue' and 'Errors' and the other (query B) has the columns 'Queue' and 'Correct'.

I need to write a query which combines the data from both to output a table with 3 columns 'Queue', 'Errors' and 'Correct'. However there are queues in query A which are not in query B and visa-versa.

How can i combine these together so that if a 'queue' has data in 'errors' but nothing in 'correct' it outputs a '0' in the 'correct' field and similarly if a 'queue' has data in 'correct' but nothing in 'errors' it outputs a '0' in the 'errors' field.

Help would be appreciated,im using access '97.
first, you'll need to change the two queries from make table to select queries

then write a union query to merge the two


select queue, errors from query1
union all
select queue, errors from query2;


now that you have the data together, with the union query you can create your maketable


use the nz() function to make null values 0


select nz([queue],0), nz([errors],0), "" as Correct into yournewtable
from unionquery

J
Jun 5 '07 #2

P: 34
Thanks, it all works now.
Jun 5 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.