Quantcast
Channel: Teradata Forums - Database
Viewing all articles
Browse latest Browse all 14773

To check ALL condition in Teradata - response (2) by pavan.polish

$
0
0

Hi Dieter,
Many thanks for your inputs and it worked well for the said scenario.
I got the data like below:-
GROUP_ID - MEMBER_ID - MEMBER_FLAG
M - M - N
M - N - N
M - O - N
X - X - Y
X - Y - N
X - Z - N
All members of group M has same value i.e. N.
Members of group X has mixture of values i.e. N and Y.
Here, I want to extract group having flag as N for all members of the group
When I tried to apply the same logic by changing the flag to N in given QUALIFY as below. I got both the groups.
SELECT....
QUALIFY     
MIN(MEMBER_FLAG) OVER (PARTITION BY GROUP_ID) = 'N'
AND MIN(MEMBER_FLAG) OVER (PARTITION BY GROUP_ID) =     MAX(MEMBER_FLAG) OVER (PARTITION BY GROUP_ID)
Please advise any changes required in QUALIFY for this scenario.
Thanks a lot in advance.
Sagar. 


Viewing all articles
Browse latest Browse all 14773

Trending Articles