I guess this is what you want:
SELECT count(*) as syscount FROM events WHERE alert='1' GROUP BY sysid ORDER
BY syscount LIMIT 10;
----- Original Message -----
From: "Jason Lane" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 6:54 PM
Subject: How can I get a top ten total count from a table?


>
> I'm trying to retrieve the top ten entries of a total count from a
> table. If I use the following select statement without the 'ORDER BY'
> clause it returns the totals but not in any sort of order. But when I
> add the 'ORDER BY' clause in it returns nothing.
>
> Is there a way to structure the query to do the total and return the
> total list in descending or ascending order?
>
> Example:
>
> SELECT count(*) FROM events WHERE alert='1' GROUP BY sysid ORDER BY
> sysid     LIMIT 10
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to