W
warway
The following procedure returns the data I want but I need to show just the
latest instance of each s.CurrencyCode in order to populate a combobox, any
help greatly appreciated!
Alter PROCEDURE dbo.sp_ROECurrent3 @LessDate datetime
AS
SELECT s.ROEID,s.CurrencyCode, s.ExchangeRATE, s.ROEDate, o.ROEWeighting,
o.BaseCurrency, 'Weighted ROE' =
CASE
WHEN s.CurrencyCode <> o.BaseCurrency THEN s.exchangeRate - (s.ExchangeRATE
*(1+o.ROEWeighting) - s.exchangeRate)
ELSE 1
END,
CAST(o.CurrencyName AS varchar(20)) AS 'Currency'
FROM ROECurrentView o JOIN tblkpROE s ON o.ROEDate = s.ROEdate AND
s.CurrencyCode=o.CurrencyCode
GROUP BY
s.ROEID,s.CurrencyCode,s.ExchangeRate,s.ROEDate,o.ROEWeighting,o.BaseCurrenc
y,o.CurrencyName,o.CurrencyCode
HAVING MAX(DISTINCT o.ROEDate) <= @LessDate
ORDER by o.CurrencyCode
Warway
latest instance of each s.CurrencyCode in order to populate a combobox, any
help greatly appreciated!
Alter PROCEDURE dbo.sp_ROECurrent3 @LessDate datetime
AS
SELECT s.ROEID,s.CurrencyCode, s.ExchangeRATE, s.ROEDate, o.ROEWeighting,
o.BaseCurrency, 'Weighted ROE' =
CASE
WHEN s.CurrencyCode <> o.BaseCurrency THEN s.exchangeRate - (s.ExchangeRATE
*(1+o.ROEWeighting) - s.exchangeRate)
ELSE 1
END,
CAST(o.CurrencyName AS varchar(20)) AS 'Currency'
FROM ROECurrentView o JOIN tblkpROE s ON o.ROEDate = s.ROEdate AND
s.CurrencyCode=o.CurrencyCode
GROUP BY
s.ROEID,s.CurrencyCode,s.ExchangeRate,s.ROEDate,o.ROEWeighting,o.BaseCurrenc
y,o.CurrencyName,o.CurrencyCode
HAVING MAX(DISTINCT o.ROEDate) <= @LessDate
ORDER by o.CurrencyCode
Warway