Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

Re: [PHP3] SQL: count / limited group? From: Andrian Pervazov (andrian <email protected>)
Date: 05/15/00

Dieter Kneffel wrote:
>
> currently, I am using this query to get the most used names in a
> complete (MySQL) database.
>
> $select = "select COUNT(name) as top ,name from table group by name
> order by top desc";
>
> --
>
> here's the task: I only want to get the most used names from e.g. the
> last 100 rows.
> (and just ignore the other, older entries in the db)
>
> how do I have to modify the above select? Is it possible in one query,
> do I have
> to use sub-selects (could be a problem with mysql?!), or what other
> options do I have?

try adding "LIMIT 100" at the end of the query after desc

Andrian

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>