> SQL question which I am new to.
> How would I count the number of times a specific entry is in field.  For
> instance I have a table that has the following two fields
> number        hostname
> 1                 10.1.1.1
> 2                 10.1.1.2
> 3                 10.1.1.3
> 4                 10.1.1.1
> 
> and I want the query to return something like the following
> 
> 2              10.1.1.1
> 1              10.1.1.2
> 1              10.1.1.3

SELECT count(*) AS count, hostname FROM yourtable GROUP BY hostname


---------------------------------------------------------------------
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