I currently have following two tables:
**files_list**
-listid
-name
-synonym
-description
**files_tags**
-tag_name
-listid
If someone uses the keyword "dragon ball", at the moment, I use following query to search my_list for possible matches:
**SELECT * FROM `files_list` WHERE ( name LIKE '%dragon%' OR synonym LIKE '%dragon%' OR description LIKE '%dragon%' OR name LIKE '%ball%' OR synonym LIKE '%ball%' OR description LIKE '%ball%' )**
I am not sure how to search both tables using one query. I want to show the user following data in the search result: name, synonym, description and all tags.
My Questions
1. Is there any way to make the current mysql query shorter?
2. How can I combine it with files_tags
table,
- to show rows from files_list
which has a match in files_tags
, but not in files_list
?
- to show rows from files_list
which has a match in files_list, but may not in
files_tags`?
You can see the current displayed result at http://hsbsitez.com/