php3-list | 2000051
Date: 05/15/00
- Next message: Richard Lynch: "Re: [PHP3] configure options"
- Previous message: Dieter Kneffel: "[PHP3] SQL: count / limited group?"
- In reply to: Dieter Kneffel: "[PHP3] SQL: count / limited group?"
- Next in thread: Doug Semig: "Re: [PHP3] SQL: count / limited group?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Next message: Richard Lynch: "Re: [PHP3] configure options"
- Previous message: Dieter Kneffel: "[PHP3] SQL: count / limited group?"
- In reply to: Dieter Kneffel: "[PHP3] SQL: count / limited group?"
- Next in thread: Doug Semig: "Re: [PHP3] SQL: count / limited group?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

