Hi,
I use this SQL query for find, in database MySql version 8.0.17
, the tables whose name corresponds to the condition indicated in the clause LIKE
SELECT table_name FROM information_schema.TABLES WHERE table_name LIKE't#_contents#_s3%#_1#_2021'ESCAPE'#';+-------------------------+| TABLE_NAME |+-------------------------+| t_contents_s300_1_2021 || t_contents_s34d_1_2021 || t_contents_s34g_1_2021 || t_contents_s3sv_1_2021 |+-------------------------+4rowsinset (0.30 sec)
My question is
How to do go about for union all these tables returned by the SQL query ?
Normally I would do this mode, but I don't know first all the names of the tables and the number of the tables returned by the SQL query... the names and the number of the tables it could be variable...
I'm not the administrator of this database. This schema is a remote hosting where I can only read..
SELECT
`sUn`,
`sUnName`,
`contents` 'Set'FROM
`t_contents_s300_1_2021` UNIONALLSELECT
`sUn`,
`sUnName`,
`contents` 'Set'FROM
`t_contents_s34d_1_2021` UNIONALLSELECT
`sUn`,
`sUnName`,
`contents` 'Set'FROM
`t_contents_s34g_1_2021` UNIONALLSELECT
`sUn`,
`sUnName`,
`contents` 'Set'FROM
`t_contents_s3sv_1_2021` ORDERBY
`sUn` ASC;
Thanks in advance for any help.