Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 22 Oct 2008 @ 17:14:10 GMT


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


Subj:   Re: First Row Function
 
From:   Curley, David

Hui - How are you defining the first row? The order of rows in a table is meaningless (maybe except for some pretty technical situations), what matters is the rules you provide to dictate order. If you had a date field, for example, you could get the earliest amt for each ID with

     Select id, amt
      from Sample_tbe
     Qualify SomeDate = min(SomeDate) over (partition by ID);

If there's no date and you want to pick out something like the middle amt as in your example (knowing there are always 3 amt per ID), that's easy enough - we just need to know the requirements.


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