Copy link to clipboard
Copied
I'm creating a mysql keyword search on my website and I know how to search a single mysql table, my problem is I need to search 15 different tables simultaneously, they also all have the same column names. I was told I have to you JOINS but i've never used them before. How is this done?
MY SQL SELECT:
SELECT *
FROM mytable1
WHERE keyword LIKE %colname% OR id LIKE %colname%
Copy link to clipboard
Copied
You join tables when you want to view related data. Let's start at the beginning. Why do you have 15 tables with the same column names?
Copy link to clipboard
Copied
I have an image based site, and the images are separated into 15 different catigories depending on what type of image it is. The columns are id,image,name,keyword for each table
Copy link to clipboard
Copied
Why not just put all into a single table? What is the purpose for separating these into 15 tables?
Copy link to clipboard
Copied
Because for the type of site im doing the images must remain in there specific category, and can't be mixed into one table.
Copy link to clipboard
Copied
OK, that really doesn't answer my question. Just because they are in different categories is not a valid reason. Why can't they be mixed?
In any case, you could probably use a UNION query to solve the current problem, but I would have to know more about the complete query. You don't want to use a JOIN.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more