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

  • Thread starter Thread starter RyanW.
  • Start date Start date
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?
 
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];
 
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;
 
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?
 
Back
Top