On Mon, 08 Oct 2007 02:11:09 -0700, Alec wrote:
Quote:
Sorry newbie question...
I have made two different search queries on the same table that both
retain the identical column information.
$resultfirst = @mysql_query ("SELECT company, address1, address2 FROM
table1 WHERE category=active ")
$resultsecond = @mysql_query ("SELECT company, address1, address2 FROM
table1 WHERE category=inactive ")
How can I now join these together in one list, with the results from
the first query being listed before the second, ie keeping the same
order.
Many thanks
Alec Thorne |
Hi Alec,
SELECT company, address1, address2
FROM table1
WHERE category IN ('active','inactive')
ORDER BY category;
If category can only be active or inactive, you can omit the WHERE
clause. This is only required if other categories exist as well.
--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis