On part of my site, users enter multiple search terms. Each of these search terms may return 0 rows, or return several. I perform a UNION on all the searches and get the rows.
Thing are much easier for me if I can get all the search terms in the response, regardless of whether they return any rows. Is there a way to essentially LEFT JOIN a string (in this case the search term) to a SELECT query?
More information update:
I have a table Books with the field Title.
The user enters up to 10 title search_terms, and I currently perform a UNION on all these to get matching rows. So it's like
SELECT $s[0] AS Search_Term,* WHERE Title LIKE '%$s[0]%' UNION
SELECT $s[1] AS Search_Term,* WHERE Title LIKE '%$s[1]%' ...etc
I'd like it so that if there are no results for a given search, I still get the Search_Term back along with the NULL Title.