Question : Help needed with query in Access

I have an existing query, simplified here:

Select DISTINCT tableA.*, tableB.finditHere from tableA INNER JOIN tableB ON tableA.fieldSP = tableB.fieldSP;

I want to bring in a 3rd table into the query. The 3rd table contains a field tableC.text2find.

I only want those records from tableB where tableB.finditinhere LIKE *tableC.text2find*.
How can I accomplish this? Part of my inability to figure this out is due to my inexperience joining tables using JOINs, so please give me the whole statement joining the 3 tables together.

I don't need to return any fields from tableC, I just need it to select the records.

The join would probably contain something like INSTR(tableb.finditinhere, tablec.text2find) > 0 but I doubt that I can do that using JOIN, or can I?

Answer : Help needed with query in Access

SELECT DISTINCT a.*, b.finditHere
FROM (tableA a INNER JOIN
   tableB b ON a.fieldSP = b.fieldSP) INNER JOIN
   tableC c ON b.finditinhere Like "*" & c.text2find & "*"


Access likes to see those parentheses in the FROM clause when joining >2 tables; in SQL Server you can omit them.

And yes, it is legal to use expressions other than "=", including functions, in a join expression, but be aware that doing so with large tables can lead to slow performance.
Random Solutions  
 
programming4us programming4us