![]() ![]() Resulted in the first query running but the second failing.Ĭan anyone help, or is it not possible to do something like:Ĭonnect to two databases and then have a php command like $SQL="SELECT db1 roles.HMRSmembershipNumber, people.called, people.lastnameįROM roles LEFT JOIN people ON roles.HMRSmembershipNumber = people. Those common columns are called the join key or common key. ![]() Common values are usually the same column name and data type present in the tables being joined. I then produced a script structured as follows The JOIN statement in MySQL is a method of linking data between several tables in a database based on common column's values in those tables. First and foremost you must apply to be able to join our RedM server. $seldbM=MYSQL_SELECT_DB($databasem) or die ( "Members database non existent") Use HeidiSQL to Connect to a MySQL Database>How to Use HeidiSQL to Connect to a. $dbM=MYSQL_CONNECT($serverm, $userm, $passwordm, true) or die ( "members database server unreachable") $seldb=MYSQL_SELECT_DB($database) or die ( "Database non existent") ensure that the two database connections were completely different & add the "true" parameter $db=MYSQL_CONNECT($server, $user, $password, true) or die ( "Server unreachable") Following hints found in various searches on the internet I proceeded to:ġ. The next and the last step is to join the tables using the select query having the server name as prefix for the table name. The first step is to link the SQL Servers. In the PHP script I set up two separate database connections then ran the SELECT query referring simply to the fields in the two tables (there were no common field or table names between the databases). There are 2 steps to join tables from different servers. I wish to run an SQL query to select items using a LFET JOIN between tables on two different databases. We have a website hosted by a major international company and our package includes a number of MySQL databases: these are on different servers. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |