[PHP-DB] Another UNION ALL query

2010-04-29 Thread Ron Piggott
I have a 'Highlights' heading on my home page. It is for links to content on the site ... like specific web pages I have designed the query below to select the two most popular and least popular pages used on the site to be the Highlights. (Each time a web page is accessed user_hits is

Re: [PHP-DB] Another UNION ALL query

2010-04-29 Thread maarten
Hi, while I can not help you with your direct question, I don't know of a way to order randomly and select one you hadn't selected yet in SQL, there is another way to do this. With your UNION query your already executing two 'expensive' queries, the entire table get's ordered (twice) before the

RE: [PHP-DB] Another UNION ALL query

2010-04-29 Thread David Murphy
-Original Message- From: maarten [mailto:maarten.fo...@edchq.com] Sent: Thursday, April 29, 2010 10:23 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Another UNION ALL query Hi, while I can not help you with your direct question, I don't know of a way to order randomly and select