1

I am trying to do a filter on a data set using another table to define the filter query. In the first table I have the filter strings, for example: AP, EX and SU. In a second table I have the data set that I want to filter. Apple, Applet, Abbot, Acronym, event, example, solution, sum. When I do a select I need to return only the results that begin with any value in the first table. So the results will be Apple, Applet, Example and Sum. The best that comes to my mind is the query below, which I did try and gave errors.

SELECT * FROM tblData WHERE Word LIKE (SELECT filter + '%' FROM tblFilter)

1 Answer 1

2
SELECT d.* 
FROM tblData d
JOIN tblFilter f on d.word like (f.filter + '%')
Sign up to request clarification or add additional context in comments.

1 Comment

Elegant and straight forward, this worked 100% thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.