Home  >  Article  >  Database  >  SQL statement to query two tables in different libraries on the same server.

SQL statement to query two tables in different libraries on the same server.

伊谢尔伦
伊谢尔伦Original
2016-11-23 10:26:451662browse

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.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn