How does PHP write statements for queries between multiple databases?
Source: Internet
Author: User
How does PHP write statements for queries between multiple databases? Two data tables, table1table2table1 & nbsp; table2 & nbsp in database1; in database2, how can I query data in table2 through table1? How does PHP write statements for queries between multiple databases?
Two data tables
Table1
Table 2
Table1 in database1
Table2 in database2
How can I query data in table 2 through table1 data?
------ Solution --------------------
Add the database name before the table name, with the condition that the current user has access to both databases.
Select * from database1.table1, database2.table2 where...
------ Solution --------------------
If the two databases can be accessed using the same account password, you can use
Database1.table1
Database2.table2
This form
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service