|
Posted by Alec on 10/08/07 18:17
Newbie question.
Its really an SQL question, but have had no reply from the SQL
newsgroup.
I want to search the same table for two different criteria, and then
join the search results together into one new list. See below.
<?php
$result = @mysql_query ("SELECT company, priority FROM table1 WHERE
priority ='high' "); UNION; @mysql_query ("SELECT company, priority
FROM table1 WHERE priority ='low' ");
while ($row = mysql_fetch_array($result))
{
$company = $row['company']; echo $company;
$priority = $row['priority']; echo $priority;
}
?>
BUT it only returns the first search result, even though there are
records that relate to the second.
What am I doing wrong? Also can UNION be used to combine more than two
searches?
Many thanks
Alec
Navigation:
[Reply to this message]
|