SQL Server Distinct Join

  • Question:

    Have a table Table1 with the following rows:

    PK Fld2 Fld3 Fld4

    ---- ---- ---- ----

    1 58 C D

    2 12 K J

    3 58 C D

    I want to select distinct Fld2, Fld3, and Fld4 in addition to any value of PK, i.e I want my select query to return:

    1 , 58 , C, D

    2 , 12 , K, J

    What is the simplest way of doing that .

    thanks

  • I Found It:

    Select min(PK), fld2,fld3,fld4

    from table1

    group by fld2,fld3,fld4

    it would work since I did not care which Pk is being returned.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply