Archives of the TeradataForum
Message Posted: Thu, 29 Jul 2010 @ 22:07:17 GMT
Subj: | | Re: Deleting unwanted/duplicate records |
|
From: | | Fred W Pluebell |
Again, it would help to know the real problem you are trying to solve.
Do you expect one row per I_POL, one per I_SSN, or one per distinct(I_POL, I_SSN) combination?
What should be returned if none of the corresponding rows have "RT"? Is I_IRD fixed or variable length? Is the "RT" always in the same
relative position within the field?
For example:
Return one row per I_POL. Pick one with "RT" somewhere within I_IRD,
if any; else any row with that I_POL will do.
...
Qualify Row_Number () Over (Partition by i_pol
Order by Case When i_ird like '%RT%' then 0 else 1 end) = 1
|