select count(hostname), hostName from tableName group by hostname

Cal
http://www.calevans.com
 

-----Original Message-----
From: Lance Rochelle [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 04, 2001 8:57 PM
To: [EMAIL PROTECTED]
Subject: SQL question


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.

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


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