My database contains a table tab0 with two columns, id and mjd, and thousands of tables tab1... tabM with five columns, id,A,B,C, and D. The columns contain thousands of elements.
Which is the best way to obtain something like this?
+-----+-------------+-------------+-------------+
| mjd | A (of tab_1)| A (of tab_2)| A (of tab_m)|
+-----+-------------+-------------+-------------+
|  1  | 123         | 423         | 523         |
|  2  | 233         | 243         | 633         |
| ... | ...         | ...         | ...         |
|  n  | 353         | 343         | 753         |
+-----+-------------+-------------+-------------+
Can I obtain the list of columns and tables from  INFORMATION_SCHEMA and then use it to construct my query like
SELECT t0.mjd, t1.A, t2.A, ... tM.A FROM tab0 as t0, tab1 as t1, ... tabM as tM 
WHERE  t0.id=t1.id and ... and t0.id=tM.id;
or it is a completely insane approach?