Compare current row with previous row in TEradata

General
Enthusiast

Compare current row with previous row in TEradata

We are trying to convert Informatica tranformation into Teradata

In informatica we have the following transformation

iif (PK_COLUMN=PREV_PK_COLUMN_V,'N','Y')  where they are comparing current row  with previous row .

I want to know how to convert this to Teradata SQL

Thanks

5 REPLIES
Teradata Employee

Re: Compare current row with previous row in TEradata

Is there any sorting being done in Informatica before this transformation?

Teradata Employee

Re: Compare current row with previous row in TEradata

Also, PREV_PK_COLUMN_V is not an Informatica variable, so also state whats the source of this column.

Senior Apprentice

Re: Compare current row with previous row in TEradata

This should translate to:

CASE
WHEN PK_COLUMN
= MIN(PK_COLUMN)
OVER (ORDER BY whatever
ROWS BETWEEN 1 PRECEDING END 1 PRECEDING)
THEN 'N'
ELSE 'Y'
END

Maybe you have to add a PARTITION BY, too.

Enthusiast

Re: Compare current row with previous row in TEradata

Thanks Dieter it worked .I added partition by also

Enthusiast

Re: Compare current row with previous row in TEradata

Hi Dieter, I've tried to add the partition by but it always gives me an error. How would it look like with a partition by?

Thanks,

Emil