G
Guest
I have been working for several days now to try and query 2 different
databases into one table or output. I have a working query for each that
returns the data as expected. I seem to be having trouble getting the second
query to read 2 fields from the first query as criteria. I am thinking that
maybe a "union" or "union All" is the answer. could someone please take a
look at the 2 querys below and lend me thier expertese please.
Thanx in advance for any help.
///////query #1 (works fine)//////////
SELECT idshrc.trandate, idshrc.id, idfile.custso, pcmkid.pcmark,
pcmkid.pccolor, idshrc.tranqty, idshrc.transtatus, idshrc.tranworker
FROM (idshrc INNER JOIN idfile ON idshrc.id = idfile.id) INNER JOIN pcmkid
ON (idfile.custso = pcmkid.custso) AND (idfile.pcmark = pcmkid.pcmark) AND
(idfile.seqnum = pcmkid.seqnum) AND (idfile.jobid = pcmkid.jobid)
WHERE (((idshrc.trandate)=[Enter a Date ]))
ORDER BY idshrc.id, idfile.custso, pcmkid.pcmark, pcmkid.pccolor;
/////////////////////////////////////////////
///Query #2 works fine as long as I supply a job # that it should get from
the return of query #1////////////////
SELECT labor_base.BIDNUMBER, bid_base.MKDET, bid_base.UNIQUEKEY,
bid_base.DRAWING, labor_base.QUAN, labor_base.OPERATION, labor_base.MINUTES,
bid_base.BIDNUMBER, labtable_base.DEPT, labtable_base.AUTOQUAN,
labtable_base.CODELABEL, labtable_base.CODENUM, labtable_base.FUNCTION,
labtable_base.LABEL, labtable_base.OPERATION
FROM (bid_base LEFT JOIN labor_base ON bid_base.UNIQUEKEY =
labor_base.UNIQUEKEY) LEFT JOIN labtable_base ON labor_base.CODE =
labtable_base.CODE
WHERE (((labor_base.QUAN)>0));
//////////////////////////////////
Thanx again for your time,
Klutzz
databases into one table or output. I have a working query for each that
returns the data as expected. I seem to be having trouble getting the second
query to read 2 fields from the first query as criteria. I am thinking that
maybe a "union" or "union All" is the answer. could someone please take a
look at the 2 querys below and lend me thier expertese please.
Thanx in advance for any help.
///////query #1 (works fine)//////////
SELECT idshrc.trandate, idshrc.id, idfile.custso, pcmkid.pcmark,
pcmkid.pccolor, idshrc.tranqty, idshrc.transtatus, idshrc.tranworker
FROM (idshrc INNER JOIN idfile ON idshrc.id = idfile.id) INNER JOIN pcmkid
ON (idfile.custso = pcmkid.custso) AND (idfile.pcmark = pcmkid.pcmark) AND
(idfile.seqnum = pcmkid.seqnum) AND (idfile.jobid = pcmkid.jobid)
WHERE (((idshrc.trandate)=[Enter a Date ]))
ORDER BY idshrc.id, idfile.custso, pcmkid.pcmark, pcmkid.pccolor;
/////////////////////////////////////////////
///Query #2 works fine as long as I supply a job # that it should get from
the return of query #1////////////////
SELECT labor_base.BIDNUMBER, bid_base.MKDET, bid_base.UNIQUEKEY,
bid_base.DRAWING, labor_base.QUAN, labor_base.OPERATION, labor_base.MINUTES,
bid_base.BIDNUMBER, labtable_base.DEPT, labtable_base.AUTOQUAN,
labtable_base.CODELABEL, labtable_base.CODENUM, labtable_base.FUNCTION,
labtable_base.LABEL, labtable_base.OPERATION
FROM (bid_base LEFT JOIN labor_base ON bid_base.UNIQUEKEY =
labor_base.UNIQUEKEY) LEFT JOIN labtable_base ON labor_base.CODE =
labtable_base.CODE
WHERE (((labor_base.QUAN)>0));
//////////////////////////////////
Thanx again for your time,
Klutzz