Hi Team, I need a simple query where I can the partner id with contract status='C' which does not have any contract status in 'A' and 'B'. I need to find the Partner id of row number 3 since the partner id 2 does not have any contract status of A or B. Similarly, I want to filter partner ids which have contract status 'A' or 'B' but not contract status 'C' . That is , I need the partner id of row number 5,6. Thanks in advance
Yet another option is to use the analytical function MAX
as follows:
SELECT *
FROM (SELECT T.*,
MAX(STATUS) OVER(PARTITION BY PARTNERID) AS MAX_STATUS
FROM T)
WHERE MAX_STATUS = 'A';