Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Fri, 08 Feb 2008 @ 16:45:47 GMT


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


Subj:   Re: How to code a join or restructure table?
 
From:   Curley, David

What if they decide to add a step between some of the current amounts? You'd have to generate a new ID for every row. (A good example of why a surrogate key should have no meaning other than as a key.)

If all you want is the row with the greatest amount less than or equal to X, something like these should work:

     Select top 1 *
      from adhoc.rates
     Where amount <= .1653
     Order by amount desc

Or

     Select *
      from adhoc.rates
     Where amount <= .1653
     Qualify row_number() over (order by amount desc) = 1

Dave



     
  <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: 15 Jun 2023