Archives of the TeradataForum
Message Posted: Thu, 07 Feb 2008 @ 21:46:49 GMT
Since my table only has 3,000 rows my first attempt was to use the approach that joins the table to itself but I am getting the row 68 with .1699 but I actually need the rate from the prior row (rate = .1599)
My next attempt used the ranking SQL of
SELECT * FROM rates WHERE amount < .1653 QUALIFY RANK() OVER (PARTITION BY name ORDER BY amount DESC) = 1
But this returns 16 rows that are less than 0.1653.
Have I coded this incorrectly?
SELECT * FROM prodvw.penalty_schedule WHERE differential_am < .1653 QUALIFY RANK() OVER (PARTITION BY standard_penalty_am ORDER BY differential_am DESC) = 1
Thanks for your assistance!
|Copyright 2016 - All Rights Reserved|
|Last Modified: 28 Jun 2020|