jeudi 26 février 2015

Multiple records and determine if a combination if values exist and write this to a new column


I'm struggling with a problem.


An order can have multiple lines and accordingly a type (F=Footwear/N=Non-FTW,Mixed=Both) I need to determine if the order consists of which type and create a new column with this information.



ORDR | TYPE
-----------------------------------------
#31900440220151005215630000 | F
#31900440220151005215630000 | N
#31900440220151005215630000 | N
#31900440220151005215680000 | N
#31900440220151005215680000 | N
#31900440220151005215680000 | N
#31900440220151005215680000 | N
#31900440220151005215680000 | N
#31900440220151005215710000 | F
#31900440220151005215720000 | F
#31900440220151005215740000 | F


What I want to have is ultimately:



ORDR | TYPE | New column
------------------------------------------------
#31900440220151005215630000 | F | Mixed
#31900440220151005215630000 | N | Mixed
#31900440220151005215630000 | N | Mixed
#31900440220151005215680000 | N | Non-FTW
#31900440220151005215680000 | N | Non-FTW
#31900440220151005215680000 | N | Non-FTW
#31900440220151005215680000 | N | Non-FTW
#31900440220151005215680000 | N | Non-FTW
#31900440220151005215710000 | F | FTW
#31900440220151005215720000 | F | FTW
#31900440220151005215740000 | F | FTW


I thought of partition over but currently i'm stuck.





Aucun commentaire:

Enregistrer un commentaire