Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Thu, 07 Feb 2008 @ 21:46:49 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: How to code a join or restructure table?
From:   Pinti, Michele A

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
         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 *
     WHERE differential_am < .1653
         RANK() OVER (PARTITION BY standard_penalty_am
                      ORDER BY differential_am DESC) = 1

Thanks for your assistance!

  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 28 Jun 2020