This method is limited to databases on the same server.
1. Create two databases, library A (table a) and library B (table b).
Second, assign the same account permissions to the two libraries.
3. Use the following statement when querying:
select * from A.dbo.a, B.dbo.b where A.dbo.a.id=B.dbo.b.id
The effect achieved by this sql statement is In database A and database B, the data with the same ID in table a and table b.
The above method is a simple join table query on the same server and different libraries.