Results 1 to 4 of 4

Thread: SELECT field > 1 time

  1. #1
    Join Date
    Apr 2006
    Posts
    178

    SELECT field > 1 time

    hello !

    for MS SQL 2000

    how can I get something like

    SELECT name from users WHERE Count(name) > 1

    i want to return only the rows where name appears more than 1 time

    thank you

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,931
    SELECT name from users
    GROUP BY name
    HAVING Count(*) > 1

  3. #3
    Join Date
    Apr 2006
    Posts
    178
    select name
    from users
    group by name
    having count(*) > 1

    works fine thank you

  4. #4
    Join Date
    Apr 2006
    Posts
    178
    to get all of them and not only one i am using and not only one

    select name from users
    WHERE name IN(
    select name
    from users
    group by name
    having count(*) > 1
    )


    is it the best way ?

Posting Permissions

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