Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 21 Apr 2009 @ 09:35:28 GMT


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


Subj:   Re: SELECT Subquery
 
From:   Anomy Anom

<-- Anonymously Posted: Monday, April 20, 2009 20:53 -->

Making a few assumptions about your data model - but I'd try:

     SELECT Loan.LoanID, Tran.Amount
     FROM Loan INNER JOIN Tran
     ON Loan.LoanID  = Tran.LoanID
     WHERE Tran.Type = 'D'
     QUALIFY ROW_NUMBER() OVER (PARTITION BY Tran.LoanID ORDER BY PostDate
     DESC) = 1;


     
  <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