I have a muliti-tenant database structure where each tenant resides in a separate database.
So what I had wanted is to create a procedure that spools data of particular tables from all these databases having the same prefix.
Below is the code i have but seems to result to what i want.
SELECT CONCAT('SELECT * FROM ', TABLE_SCHEMA, '.', TABLE_NAME, ';')
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'm_appuser'
AND TABLE_SCHEMA LIKE 'mifostenant%'
Result of the above is as below;
Your kind help is highly appreciated.
SELECT
statements that could be used to select the data. You would like to automate this second step. Do I understand your question correctly?