SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member Freddie's Avatar
    Join Date
    Jul 2000
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have a table like such:

    ID TEXT

    Say I have this data:

    1,"text"
    1,"hello"
    1,"hi"
    1,"hey"
    2,"bye"
    3,"come"
    4,"go"
    4,"in"
    5,"out"

    Can I get a result using a select that will tell me how many times each userid appears in the result?

    Would look something like this:

    ID TIMES IN RESULT
    1 4
    2 1
    3 1
    4 2
    5 1

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    try this:

    select ID, count(ID)
    from tablename
    group by ID;

    Vinny

    ------------------
    my site:GrassBlade: cut&paste javascript
    moderator at:The JavaScript Place Forums
    Javascript City


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •