Hello I have one MySql database with 4000 tables. All the tables have same data structure. I want to retrieve data from one column "name" which is inside all the tables. I want to list all that data.
I had searched through google, stack overflow and many more resources. But I don't find any specific answer to do this without join or union. As I don't want to write that 4000 names in query. Is there any general query to do it fast. I think that might be possible to get data using information schema table but I don't know how.
As I know how to select tables:
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('Product')
AND TABLE_SCHEMA='YourDatabase';
But I don't know query to get data out of them.
Thank You.