At 9:57 PM -0400 9/4/01, Lance Rochelle wrote:
>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
>
>
>What I may be asking may need to have an external program but I figure it
>might be able to be done inside one SQL statement.

SELECT COUNT(*), hostname FROM tbl_name GROUP BY hostname

>
>Lance Rochelle
>[EMAIL PROTECTED]
>(607) 775-2681
>-------------------------------------------
>Being a Systems Administrator is like
>hitting yourself in the bead with a brick.
>After a while you don't feel the pain.
>--------------------------------------------


-- 
Paul DuBois, [EMAIL PROTECTED]

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