#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2001
    Posts
    49
    Rep Power
    14

    count and destinct?


    Hi,

    If I have a database table like this:
    webpageid entrydate websiteid
    3 2/6/03 4:51:49 PM 1
    1 2/6/03 4:47:46 PM 1
    1 2/6/03 4:45:07 PM 2
    1 2/6/03 4:43:45 PM 7
    3 2/6/03 4:42:18 PM 7


    And I want to query the table to bring back the count of each websiteid. I am looking for a result like this:
    websiteid: 1, count 2
    websiteid: 2, count 1
    websiteid: 7, count 2

    Does anyone know the sql that will bring back those results? or is it even possible to do this?
    Auction off your web site real estate.

    http://www.webmasterbids.com
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2002
    Posts
    693
    Rep Power
    26
    select websiteid, count(*) group by websiteid

IMN logo majestic logo threadwatch logo seochat tools logo