SELECT
TABLE_NAME '表名',
COLUMN_NAME '字段名',
CONCAT( 'SELECT * from ', table_name, ' WHERE 填入要查询的字段名 = "3" ;' ) AS `sql语句`
-- CONCAT拼接sql语句,按需要修改
FROM
information_schema. COLUMNS
WHERE
TABLE_SCHEMA = '填入要查询的库名'
AND COLUMN_NAME = '填入要查询的字段名';