I have an MySQL database with multiple tables that have the exact structure, I want to search on the same column from each table.
Something like
SELECT part_number FROM * WHERE part_number LIKE $term
*
is not working for all tables.
How can i make it work ?
Select *
from table1,table2,table3 --(all tables)
where table1.part_number LIKE'%term%'
and table2.part_number LIKE'%term%'
and table3.part_number LIKE'%term%'
--(all tables conditions)
it should work
You could use union I guess.
(SELECT part_number FROM t1 WHERE part_number LIKE'%term%')
UNION
(SELECT part_number FROM t2 WHERE part_number LIKE'%term%')