I have the following query in mysql 5.1.41:
select distinct table_schema from information_schema.tables where table_schema like '% dog%';
I want to take the output of this command:
+ ------------------- +
| table_schema |
+ ------------------- +
| dog_a |
| dog_b |
+ ------------------- +
and then use the database names as input to the query, for example:
select count (*) from (select * from dog_a.log where insane = 1 UNION ALL select * from dog_b.log where insane = 1) as total_count;
so the algorithm is essentially:
. , , , mysql.
.
?
!