PDA

View Full Version : Filtering data with a dummy table



kit_sune
2019-01-16, 12:40 AM
I’ll get straight to the point.
Using fields from a form I created a dummy query thatprovides 4 values in a single record. These values change all the time depending on what the user wants at any given moment, and these values are used to impact a growing number of queries’ filters. The goal was to reference oneor more columns from this dummy query to filter out my data, but I get the error “Query input must contain at least one table or query” when I attempt touse this query.

Here's the example:

Dummy Query created from Form values



Month
Location
EquipType


1/1/2019
CA
A



Data table



Month
Location
EquipmentType
Comment


1/1/2019
CA
A
ADASD


1/1/2019
CA
B
aASDASD



So in this example, when I run the query that references both the main table, and the dummy query, it would pull the first record but not the second one.
I took a basics of SQL class recently and so I tried to do it by inserting a SELECT statement into the WHERE clause, and I even tried to join the query and table together, but this is the error that I receive.


For additional context, I tried to create a query to the query where it only provided the data from the dummy query and received the same result.
I can't provide the SQL because it's not available on this computer, but it's basically just "SELECT a, b, c, from tableName WHERE c IN(SELECT c FROM dummyQryName)"

Thank you for your time,
~Kit

kit_sune
2019-01-16, 05:15 PM
While a crude way to get it to work, IMHO, I fixed this issue by just selecting the smallest table in the database, and telling it to "SELECT DISTINCT..." and then create my dummy table from that.
~Kit