Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2015
    Posts
    10

    Lightbulb Unanswered: How to eliminate duplicate rows based on column value

    I have a query that have the following output (Duplicate Prod IDs but unique Prod Type)

    Prod ID Prod Type
    1 A
    1 B
    2 A
    3 B
    4 A
    4 B
    5 B
    .
    .
    .


    Desired Result (For rows with duplicate Prod IDs, keep the 1st row Prod Type A and remove the duplicate row with Prod Type B); other unique rows remain:

    Prod ID Prod Type
    1 A
    2 A
    3 B
    4 A
    5 B
    .
    .
    .

    Any suggestions would be greatly appreciated.

    Thank you,
    Zach

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    SELECT ProdID, MIN(ProdType)
    FROM ...
    GROUP BY ProdID
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    Join Date
    Dec 2015
    Posts
    10
    Thank you for your help, Florin!

Posting Permissions

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