select statement to branch two DB's

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Deddog
Forum Commoner
Posts: 55
Joined: Thu Sep 26, 2002 6:05 am
Location: Brighton

select statement to branch two DB's

Post by Deddog »

I’m using the first select statement to get the parameters I need for the second select statement. How should I manipulate the data into a format that can be used in the second select statement?

The reason I’m doing two separate selects is that the data is held in two different databases.

Please help.

//
//------------------------------------------------------------------------------------------------------
// -- find out which employees are off on hols and that have an available office - lee 28/04/2003
ConnectContacts();
$sqlOff = "SELECT contactDetails.Office FROM contactDetails LEFT JOIN absent ON contactDetails.Contact_Id=absent.User_Id and (absent.Start_Date >='$TempDate' and absent.End_Date <='$TempDate')
WHERE absent.User_Id IS NULL";
$resultOff = mysql_query($sqlOff);
//
//------------------------------------------------------------------------------------------------------
// Now lets get the offices available on the inputted date - lee 28/04/2003
$sqlAMOff = "SELECT rooms.* FROM rooms WHERE rooms.RoomsId LIKE $resultOff and rooms.Available = 'Yes'";
$resultAMOff = mysql_query($sqlAMOff);
//
//------------------------------------------------------------------------------------------------------
//
Deddog
Forum Commoner
Posts: 55
Joined: Thu Sep 26, 2002 6:05 am
Location: Brighton

Opps

Post by Deddog »

Sorry, the above is using php4 and mysql.
Post Reply