I have a data set that looks like this: Member_ID Prod Prod2 UpdatedDate 1461 1459514 1459515 2017-08-07 21:40:46.000000 1461 1459514 1459515 Blank 14612 924937 936013 Blank 14618 822314 829573 Blank 14621 1450914 1455099 Blank
I want to remove duplicates at the member Id level, but want to also do the following: - if Member x's Prod1 = Prod2, then return Prod1 and Updated Date - if Member x's Prod1 is not equal to Prod2 and UpdatedDate exists for Prod2, then return Prod2 and Updated Date - if Member x has rows where Prod1 = Prod 1 AND Prod 1 is not equal to Prod 2, then return whichever has the Updated Date (if both has updated date, return the one with earlier updated date)
I have access to SQL / Teradata as well, so if writing out a code is easier, please feel free to help me that way. Thanks!
Aucun commentaire:
Enregistrer un commentaire