Archives of the TeradataForum
Message Posted: Tue, 21 Apr 2009 @ 09:29:03 GMT
Subj: | | Re: SELECT Subquery |
|
From: | | Fred Newbrough |
Hi Shaun
I left the join to the Loan table out in the previous version. Here is the corrected one:
You can do what you want by using a subquery:
Try something like this. I left the loan table out but it can easily be joined back in
Select Loan_Id,Amount
FROM
Tran t1,Loan l
WHERE
PostDate IN (SELECT MAX(Post_Date) FROM Tran t2 WHERE t1.LoanID=t2.LoanID and
Tran_Type='D') AND t1.LoanID=l.LoanID ;
-Fred
|