Need to compare 2 tables and only pull certain records from one ta

R

RyanW.

I have a monthly sales file that contains several invoices that allows
duplicate records of parts. My second table is a different sales file that
also contains several invoices and allows duplicate records. I want to match
from the second table as a basis. How do I pull matching invoices from the
two tables without pulling all the data from the first monthly sales file?
 
K

KARL DEWEY

UNTESTED UNTESTED
SELECT SecondTable.*
FROM SecondTable INNER JOIN FirstTable ON SecondTable[Invoices] = (SELECT
FirstTable.[Invoices] FROM FirstTable GROUP BY FirstTable.[Invoices])
ORDER BY SecondTable[Invoices];
 
K

KARL DEWEY

Tested and did not work. This does --
Query5 --
SELECT Table1.[HRID] FROM Table1 GROUP BY Table1.[HRID];

SELECT Table2.*
FROM Table2 INNER JOIN Query5 ON Table2.HRID = Query5.HRID;
 
R

RyanW.

Thank you, Karl.

KARL DEWEY said:
UNTESTED UNTESTED
SELECT SecondTable.*
FROM SecondTable INNER JOIN FirstTable ON SecondTable[Invoices] = (SELECT
FirstTable.[Invoices] FROM FirstTable GROUP BY FirstTable.[Invoices])
ORDER BY SecondTable[Invoices];

--
Build a little, test a little.


RyanW. said:
I have a monthly sales file that contains several invoices that allows
duplicate records of parts. My second table is a different sales file that
also contains several invoices and allows duplicate records. I want to match
from the second table as a basis. How do I pull matching invoices from the
two tables without pulling all the data from the first monthly sales file?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top