Archives of the TeradataForum
Message Posted: Wed, 06 Feb 2008 @ 21:48:52 GMT
| Subj: || || Re: How to code a join or restructure table? |
| From: || || Schafer, Michael |
In my experience joining a table to itself doesn't perform as well as using ordered analytics if you are dealing with tables with many millions
of rows. Here is another alternative for your situation.
amount as low_amount,
max(amount) over(partition by name
order by amount desc
rows between 1 preceding
and 1 preceding) as high_amount,
Hope this helps.