Skip to main content
December 3, 2011
Question

Searching multiple mysql tables, Joins?

  • December 3, 2011
  • 1 reply
  • 733 views

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%


This topic has been closed for replies.

1 reply

Participating Frequently
December 3, 2011

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?

December 3, 2011

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

Participating Frequently
December 3, 2011

Why not just put all into a single table? What is the purpose for separating these into 15 tables?