SELECT CONCAT('select ', GROUP_CONCAT(COLUMN_NAME), ' from rs.', TABLE_NAME, ' where zgh in ("222");') as str FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='rs' AND table_name in ('zzjb','zzja') and COLUMN_NAME!='id' group by table_name;
SELECT CONCAT('insert into ', TABLE_NAME, '(', GROUP_CONCAT(COLUMN_NAME), ') select ', GROUP_CONCAT(COLUMN_NAME), ' from rs.', TABLE_NAME, ' where zgh in ("222");') as str FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='rs' AND table_name in ('zzjb','zzja') and COLUMN_NAME!='id' group by table_name;