This SELECT statement is working just fine but I’d like to be able to repeat it to further refine the search.
SELECT id1
FROM table1
WHERE id2 IN (SELECT id
FROM table2
WHERE name="country"
AND value="Mexico")
For instance, if I wanted to find only locations in Mexico that had ‘Beaches’ which would be:
name="features" AND value="Beaches"
…how would I go about paring the results down further with my SELECT statement?
Probably the best way is to execute a new query and just add the additional filtering. It would be possible to filter “manually” in the client application, but that would likely be less efficient for most situations. So run a new query with more restrictions:
Note that I changed the two new column names to something different (the original query result would not have contained those other values given the original names). If by “refine”, you want to add then perhaps the query should be: