5tar-Kaster
5tar-Kaster

Reputation: 908

Filtering data using multiple table

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)

Upvotes: 1

Views: 44

Answers (1)

juergen d
juergen d

Reputation: 204924

SELECT d.* 
FROM tblData d
JOIN tblFilter f on d.word like (f.filter + '%')

Upvotes: 2

Related Questions