Home:ALL Converter>MySQL search same column(field) from multiple tables of the same structure

MySQL search same column(field) from multiple tables of the same structure

Ask Time:2014-05-07T17:44:10         Author:CodeTroubleMaker

Json Formatter

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 ?

Author:CodeTroubleMaker,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/23514245/mysql-search-same-columnfield-from-multiple-tables-of-the-same-structure
Mehrdad Hedayati :

You could use union I guess.\n\n(SELECT part_number FROM t1 WHERE part_number LIKE'%term%')\nUNION\n(SELECT part_number FROM t2 WHERE part_number LIKE'%term%')\n",
2014-05-07T09:54:21
yy