All Forums Database
saimaday 2 posts Joined 08/15
26 Aug 2015
Work around for Count distinct using Partition by

I realize you can't do a count distinct with partition by so I'm looking for a workaround. How do I combine the 2 tables to give me the result table? Thank you!

Table 1            Table 2             Result          
PNR    AAA         PNR    Orig         PNR    AAA    Orig (count distinct Orig
AB     1a          AB     IAH          AB     1a     2
AB     2a          AB     IAD          AB     2a     2


You must sign in to leave a comment.