Given that I have a table (tblFiles) with a field for fileNames, I need to use each DISTINCT filename returned from this table as an OR in the WHERE clause of another query. What is the best way to setting this up dynamically? All of my code is in VBA but if possible I would like to be able to run all of this querying logic in SQL.
So the first query would just pull the fileNames field from the table:
SELECT fileName FROM tblFiles GROUP BY fileNames;
the next query would be something like:
SELECT dateMade, invenNum, shipDate
FROM tblOrders
WHERE fileName = fileName1
OR fileName2
OR fileName3 (... the output from the first query)