select statement to branch two DB's
Posted: Wed Apr 30, 2003 3:24 am
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);
//
//------------------------------------------------------------------------------------------------------
//
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);
//
//------------------------------------------------------------------------------------------------------
//