Janos Koppany wrote:
>
> Hi,
>
> with some databases I can select from multiply databases with UNION like
>
> SELECT db1.foo .....
> UNION
> SELECT db2.foo ....
> ....
> ORDER BY 1
>
> Is there any way with MySQL to "merge" the db1.foo and db2.foo tables,
> where the foo table structure is exactly identical in both databases.
> In my application sometimes I just would see the db1.foo, or sometimes
> the unions of db1.foo, db2.foo, .... , dbN.foo.
>
> Thanks
>
> Janos
Hi Janos
Yes, but you have to use a temporary table for this like:
1) CREATE TABLE tmpxxxx (foo ....);
2) INSERT INTO tmpxxxx SELECT db1.foo .....;
3) INSERT INTO tmpxxxx SELECT db2.foo .... ;
4) SELECT * FROM tmpxxxx WHERE ... ORDER BY l;
Tschau
Christian