Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 exchange rates

Author  Topic 

craigwg
Posting Yak Master

154 Posts

Posted - 2011-10-24 : 15:24:09
I have a view that pulls a series of numbers. I also have a table of exchange rates. I have joined that table correctly so for each record I have the appropriate exchange rate to euros.

But now I am being asked to present values in USDollars as well. I SHOULD be able to join on my exchange rates table again to get a value converting my euro values to USDollars. Not sure how to do that though.

Here is my current from statement:


FROM [dboard].dbo.vw_operations o
INNER JOIN tpr..vw_info_lob_ccms l on o.lobid=l.lobid
LEFT JOIN [dboard]..exchangerate er on l.subsidiaryid = er.subsidiaryid and o.description = er.effectivedate


This is all correct. The values in the exchange rate table are:

currencycode, effectivedate, eurorate

There are about 30 different currencies being reported once per month. I'm happy to fill in any missinf information.

Craig Greenwood

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-10-24 : 21:22:26
join to the exchange rate table twice, to convert to EURO and then from EURO to USD

something like

SELECT euro_value = value * eurorate, usd_value = value * eurorate / eurorate
FROM . . .
INNER JOIN exchangerate er on er.currencycode = ?.currencycode
INNER JOIN exchangerate us on us.currencycode = 'USD'



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -