Forum Moderators: open
but listing each animal only once.
$currentname=null;
while ($row=mysql_fetch_array($result)) {
$animal = $row['name']; // just gets the first
$state = $row['state'];
$currentname=($currentname==$animal)?' '$animal;
echo "<tr><td>$currentname</td><td>$state</td></tr>";
}
Select name, description, imageURL
From animals Where name In
(Select name From states Where state = 'WA' Or state = 'OR')
Order By name Asc It's not tied to the animals table by name. If there are no states records for 'WA', it will **only** match on area records for 'OR' where it joins on name. Which is the desired effect. So bracket them,
WHERE (states.area = 'WA' OR states.area = 'OR')
AND animals.name = states.name
and that should fix it.
Let me know if it works.
Select *
From animals Where name In
(Select name From states Where state = 'WA' Or state = 'OR')
Order By name Asc