You are here: Re: Joining search queries « PHP Programming Language « IT news, forums, messages
Re: Joining search queries

Posted by Boris Stumm on 10/09/07 10:16

Alec wrote:
[...]
> $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.

In SQL, you do that again by only using ONE statement.

SELECT company, address1, address2
FROM table1
WHERE category in ('active', 'inactive')
ORDER BY category ASC;

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация