你好我有三个表,包括远程员工,财产和交易的名称。
在第一个查询中,我有属性和远程员工表,但我的第二个查询是
事务表在此查询中我需要使用名称
的第一个查询列remoteemployees.RemoteEmployeeID到第二个查询。
我该怎么做?
<?php //first query code
error_reporting('0');
ob_start();
session_start();
if(!isset($_SESSION['email']))
{
echo '<META HTTP-EQUIV="Refresh" Content="0; URL= ../../spd/myaccount.php">';
exit();
}
else
{
$email = $_SESSION['email'];
require_once('../../Admin Panel/db.php');
$query = "SELECT
properties.PropertyID,
properties.PropertyType,
properties.PropertyDealType,
properties.Status,
properties.PropostedPrice,
properties.PropertyStatus,
properties.RemoteEmployeeEmail,
properties.PropertyDealerName,
properties.PropertyOwnerName,
remoteemployees.RemoteEmployeeID
FROM remoteemployees, properties
WHERE remoteemployees.RemoteEmployeeEmail = properties.RemoteEmployeeEmail
AND properties.RemoteEmployeeEmail = '".$email."'
AND properties.Status= 'Active'
AND properties.PropertyStatus= 'APPROVED'
ORDER BY properties.PropertyID
";
$query_run = $connection->query($query);
if( $connection->error ) exit( $connection->error );
while($res=$query_run->fetch_assoc()) {
$count = $query_run->num_rows; // Taking the number of queries returened by the result
$array[] = $res;
}
?>
//第二个查询代码:
<?php $queryemail= "SELECT SUM(transactions.EarnAmount) AS TotalEarn, transactions.TaxDeduction,
SUM(transactions.AmountPaid) AS TotalPaid from transactions WHERE transactions.RemoteEmployeeID = I want to use remoteemployees.RemoteEmployeeID from first query in here ?>