select one of the duplicate rows and keep the others to be NULL SQL Netezza

I don’t think I really recommend this, but you can do:

select LOG_DATE, ITEM_ID, PROBLEM,
       (case when row_number() over (partition by CALL_DATE, UCID, ID, ACCOUNT_NO, CALL_STATUS order by log_date desc) = 1
             then call_date
        end) as call_date,
       (case when row_number() over (partition by CALL_DATE, UCID, ID, ACCOUNT_NO, CALL_STATUS order by log_date desc) = 1
             then ucid
        end) as ucid,
       . . .
from t;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top