SELECT * FROM tables WHERE field1 LIKE 'term1' OR field1 LIKE 'term2'
SELECT * FROM tables WHERE field2 LIKE 'term1' or field2 LIKE 'term2'
What I would like is for these results to be 'joined' such that only matches between the two result sets are returned.
term1 and term2 may both be applicable to only field1, only field2, or both fields.
I guess another way to look at this would be that I want to do a clause like:
WHERE x AND y AND z (there are actually three fields)
but only if x, y, and z all return results. If one of them does not, it should not be included.
Any ideas how I can obtain the query I am after?
The only thing I can think of is to create three separate queries and then query those with JOINs.
Edited by: Davidd31415 on Sun Jul 12 12:45:36 EDT 2009.