I have to update the query every time.
Therein lies the difficulty with the schema design.
You could write a stored procedure to locate all the tables (use
information_schema.TABLES, etc) and build the UNION, and finally execute it.
The SP would have something very remotely like the foreach
2013/07/30 14:12 -0400, Sukhjinder K. Narula
I have several databases (all with same structure), which I to query. For
instansce:
db1, db2, db3 - all have table tb1 with field a, b and table tb2 with
fields flag1, flag2
So I want to query and get field a from tb for all db's. One way to do is