SQL Server Performance

select top n unique records from table

Discussion in 'General Developer Questions' started by mpolaiah, Apr 18, 2009.

  1. mpolaiah New Member

    Hi all,
    these is my result bu i want result
    ID count
    1 10
    1 20
    1 30
    1 40
    1 5
    1 8
    2 8
    2 77
    2 66
    2 33
    2 99
    2 22
    3 44
    3 33
    3 22
    3 44
    3 99
    3 366
    but i want result...
    select top 2records for each unique id
    ID count
    1 10
    1 20
    2 8
    2 77
    3 44
    3 33
    regards pols


  2. Madhivanan Moderator

Share This Page