I have two MSSQL databases on one server. I would like to do an INNER JOIN to show the results of all of the records where the "ShipToCustomerID" field in the "upsxport" table in the "ups_tracking" database has a corresponding record in the "cus_no" field in the "arcusfil_sql" table in the "data" database.
This is my latest attempt to connect to the two databases (which fails):
$hostname = "SERVER";
$username = "user";
$password = "pass";
$dbName1 = "DATA";
$dbName2 = "UPS_TRACKING";
MSSQL_CONNECT($hostname,$username,$password) or DIE("DATABASE FAILED TO RESPOND.");
$db1 = mssql_select_db($dbName1) or DIE("Table1 unavailable");
$db2 = mssql_select_db($dbName2) or DIE("Table2 unavailable");
$query = "SELECT data.ARCUSFIL_SQL.cus_no,UPS_TRACKING.upsxport.ShipmentInformationShipmentID FROM ARCUSFIL_SQL FROM upsxport INNER JOIN DATA.ARCUSFIL_SQL ON UPS_TRACKING.upsxport.ShipToCustomerID=DATA.ARCUSFIL_SQL.cus_no ";
The errors I get are similar to this:
"Warning: mssql_query(): message: Invalid object name 'DATA.ARCUSFIL_SQL'."
I have also tried a number of variations using "$db1..ARCUSFIL_SQL.cus_no" etc.
I can not make the query work.
Any help would be appreciated.