Quantcast
Viewing all articles
Browse latest Browse all 13329

How to derive this column for immediate duplicates?.

I have a requirement to derive a column based on the key columns by sorting the UPDATED_DT column.

The key columns are DEPT_CD,STATUS,START_DT. I have tried all the Analytic functions but couldn't get to that. any help would be greatly appreciated.

Note:- the Column DUPL in output need to be derived.

Input

Code:

DEPT_CD,STATUS,START_DT,UPDATED_DT
100,Active    ,Jan 10 2013,Jan 10 2013 9:56:18 AM 000000
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:19 AM 000000
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:20 AM 000000
100,Queued    ,Jan 10 2013,Jan 10 2013 9:56:21 AM 000000
100,Closed    ,Jan 10 2013,Jan 10 2013 9:56:22 AM 000000
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:23 AM 000000
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:24 AM 000000

Output

Code:

DEPT_CD,STATUS,START_DT,UPDATED_DT,DUPL
100,Active    ,Jan 10 2013,Jan 10 2013 9:56:18 AM 000000, 1
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:19 AM 000000, 1
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:20 AM 000000, 2
100,Queued    ,Jan 10 2013,Jan 10 2013 9:56:21 AM 000000, 1
100,Closed    ,Jan 10 2013,Jan 10 2013 9:56:22 AM 000000, 1
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:23 AM 000000, 1
100,Pending  ,Jan 10 2013,Jan 10 2013 9:56:24 AM 000000, 2

Cheers,
Laknar

Viewing all articles
Browse latest Browse all 13329

Trending Articles