Results 1 to 3 of 3

Thread: Select Distinct

  1. #1
    Join Date
    Aug 2003
    Posts
    18

    Unanswered: Select Distinct

    Hi everybody,

    I would like to select in a SQL Server table each field called "id" where "clientname" is different.

    I mean for each same clientname there are various "id". I want to get them.

    I know there is a DISTINCT stetment but i don't get the result i Want

    Thank U

  2. #2
    Join Date
    Oct 2003
    Posts
    5
    Why don't u use a group by?

    Select ID, NAME from TABLE GROUP BY ID, NAME

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    select id, clientname
    from yourtable
    where clientname in
    ( select clientname
    from yourtable
    group by clientname
    having count(*) > 1 )
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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