I currently running two queries to find one result, I have a good feeling I can combine these two queries into one. I've tried the method below but it's still showing me results that already appear from access_number table.
$query = "select * FROM `$table`.`access_number` WHERE `active`='1'";
$result = mysql_query($query,$db) or die(mysql_error());
while($row = mysql_fetch_array($result)) {
list($dd_inuse) = mysql_fetch_row(mysql_query("SELECT `did` FROM `$table`.`customer_dd` WHERE `did`='$row[did]' AND `callerid`='$callerid' LIMIT 1",$db));
if(!$dd_inuse) {
$goodone = $row['did'];
break;
}
}
I tried combining it like this and it's not showing me unique values
select `access_number`.`did` from `access_number`
INNER JOIN `customer_dd`
WHERE `customer_dd`.`callerid`='$callerid'
AND `customer_dd`.`did` !=`access_number`.`did` LIMIT 1
Bottom line is, I'm trying to find a value in table access_number that does not exist in customer_dd
Any kind of help I can get on this is greatly appreciated!