Mysql
 SQL >> Database >  >> RDS >> Mysql

UNION MySQL da più tabelle/database

Si può aggiungere un campo che identifichi l'origine del record:

select field1, field2, 1 as db from db1.tb
union
select field1, field2, 2 as db from db2.tb1

In questo modo ogni riga mantiene il riferimento al database di provenienza.