Thread: SQL Help !!!
View Single Post
Old 06-12-2006, 12:39 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,529
sde is on a distinguished road
if you were to use php to do it that way, it might look something like this:
PHP Code:
<?
$contacts 
= array();

$result mysql_query("select * from table where location1='london'");
while (
$row mysql_fetch_assoc) {
  
$contacts[] = $row;
}

$result mysql_query("select * from table where location2='london' AND location1 != 'london");
while (
$row mysql_fetch_assoc) {
  
$contacts[] = $row;
}

$result mysql_query("select * from table where location3='london' AND location1 != 'london" AND location2 != 'london');
while (
$row mysql_fetch_assoc) {
  
$contacts[] = $row;
}

// then maybe some more logic to check for duplicates
?>
__________________
Mike
sde is offline   Reply With Quote