TERADATA SQL QUERY REQUIRED (SCD TYPE 2)

General
Enthusiast

TERADATA SQL QUERY REQUIRED (SCD TYPE 2)

Hi,

I am having table emp and three fields

Empno Deptno Location

101 1 Chennai ....................... 1st change
101 1 Mumbai........................ 2nd change
101 1 Hyderabad ..................... Latest & 3rd change

My requirement is i wanna have latest location records (o/p Hyd) and Previous also.
Awaiting for ur response

3 REPLIES
Junior Contributor

Re: TERADATA SQL QUERY REQUIRED (SCD TYPE 2)

select * from tab
qualify row_number() over (partition by empno order by column_which_indicates_the_change_order desc) <= 2

Dieter
N/A

Re: TERADATA SQL QUERY REQUIRED (SCD TYPE 2)

Hi,
I am trying to find out about- How can i get the cout of any items day vise.
kri
Fan

Re: TERADATA SQL QUERY REQUIRED (SCD TYPE 2)

mr azam ur question is not clear for me if u describe clearly so i solve it out okay thanks