Simply add the name of the databases in front of the table name - example:
[database1].[dbo].[table_A]
and
[database2].[dbo].[table_B]
If the databases are in two different servers, just add the SQL server instance name the same way:
[Server1].[database1].[dbo].[table_A]
and
[Server2].[database2].[dbo].[table_B]