How to check if two columns match from joined tables?

I’m trying to check two see if the customer is within range of the realtor and if so to email that realtor. So far I got to the point where I can calculate the distance in the query. So since I can match those that are in distance how to check if two columns match? I need to know if two columns match what is the best way for this to be done?


$realtCust = $db->prepare("SELECT
    rid
  , rEmail
  ,id
  , eMail
FROM realtors r
    LEFT JOIN
  customers c
    ON pow(clatitude-rlatitude, 2) + pow(clongitude-rlongitude, 2) < pow(100/110.25, 2)
ORDER BY rid, id");

$realtCust->execute();
$realtCust->rowCount();


$realtCust_row = $realtCust ->fetch(PDO::FETCH_ASSOC);



$rcArray = array(
     [$realtCust_row['rid'],$realtCust_row['rEmail']],
     [$realtCust_row['id'],$realtCust_row['eMail']],

);
foreach( $rcArray as list( ,$rcEmail)) {
    //echo "$a\n";

     echo $rcArray;
}

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.