Re: group queries result

From: Date: Mon, 13 Sep 2004 08:34:41 +0000
Subject: Re: group queries result
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196489@lists.php.net to get a copy of this message
Barbara Picci wrote:
I've to extract data from a mysql db using two different queries and I must have an unique output sorting them alphabetically. For istance, query1: select * from ads where guest='PK'; count the number of results, make the difference between a given number and the number of results (variable $num). query2: select from ads where guest='PK' limit $num; now I have to export all results together sorting them.
Why not do SELECT FROM ads WHERE guest='PK' ORDER BY sortfield ASC LIMIT $num ? That would get you a sorted list. I don't understand why you are using $num, other than pagination. You also didn't mention how this is related to PHP, it seems to be a SQL issue.

« previous php.general (#196489) next »