Assuming your databases are not in SQL Server or Oracle or similar RDBMS you would need to:
Create a second ODBC connection to the other source for the YY database
If you are using an RDBMS like SQL Server or Oracle you have the ability in your select clause to fully qualify the path to your data. For example you can select data like
Select * from XX_HR (assuming your connection defaults to the database the XX_HR table is in.
But you could specifically qualify your command like
Select * from DatabaseName.Owner.XX_HR or DatabaseName..XX_HR
But it all depends on your environment and you haven't provided any of that information. For all we know XX_HR is an Access Databae and YY_HR is some Flat File DB system.