List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 5 2001 1:57am
Subject:Re: SQL question
View as plain text  
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
>lrochelle@stripped
>(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, paul@stripped
Thread
SQL questionLance Rochelle5 Sep
  • Re: SQL questionPaul DuBois5 Sep
  • RE: SQL questionChris Bolt5 Sep
  • RE: SQL questionCal Evans5 Sep
  • Re: SQL questionRodney Broom5 Sep