Connor and Chris will both be at AI World from October 12 to October 17 , the premier Oracle conference of 2025. If you're in Vegas, please come say Hi or pop into our sessions
Thanks for the question, Manjunatha.
Asked: July 18, 2017 - 5:59 pm UTC
Last updated: July 18, 2017 - 11:40 pm UTC
Version: 11g
Viewed 1000+ times
select * from tableA where changecd in ('A','U') and (appropriate_primary_key_columns) not in ( select appropriate_primary_key_columns from tableA where changecd = 'D' )
select * from ( select t.*, row_number() over ( partition by appropriate_cols order by case when changecd in ('A','U') then 1 else 2 end ) as r_au, count(case when changecd = 'D' then 1 end) over ( partition by appropriate_cols ) cnt_d, count(case when changecd in ('A','U') then 1 end ) over ( partition by appropriate_cols ) cnt_au from tablea ) where r_au = 1 and cnt_d = 0 and cnt_au > 0
Analytic SQL got you confused? Check out Connor McDonald's complete video course.