need help with t-sql looping

Last Post 26 Sep 2007 01:55 AM by SwePeso. 0 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
SwePeso
New Member
New Member

--
26 Sep 2007 01:55 AM
SELECT s.Client_No,
s.Client_Name,
s.Client_Address,
t.Tran_No,
t.txnDt,
t.Currency_Cd,
t.mxDt,
c.Ctr_Code,
c.Spot_Rate,
c.Spot_Dt
FROM (
SELECT t.Client_No,
t.Tran_No,
t.txnDt,
t.txnAmt,
t.Currency_Cd,
(SELECT MAX(Spot_Dt) FROM Conv AS c WHERE c.Currency_Cd = t.Currency_Cd AND c.Spot_Dt <= t.txnDt) AS mxDt
FROM Txn AS t
INNER JOIN Client AS c ON c.Client_No = t.Client_No
) AS t
INNER JOIN Conv AS c ON c.Currency_Cd = t.Currency_Cd AND c.Spot_Dt = t.mxDt
INNER JOIN Client AS s ON s.Client_No = t.Client_No
You are not authorized to post a reply.

Acceptable Use Policy