Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 22 Oct 2008 @ 15:24:09 GMT


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


Subj:   Re: First Row Function
 
From:   Zhong, Hui

Hi,

The Select top n * from <table>; only returns the n rows specified. Is there a way to return the top 1 row for every group by?

For example, I have a table shown below.

     Sample_tbe

     ID     amt
     001    300
     001    301
     001    299
     002    500
     002    499.34
     002    500.84
     ...

How can I display only the first row by each ID? The result I want see is

     Sample_tbe

     ID     amt
     001    300
     002    500

Thank you!

Hui



     
  <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