Sunday, February 12, 2012

Calculating a Local Currency Value

I've written an Sql statement to extract the Currency Amount and the currency rate and I want to calculate the Amount in Local Currency.

If the currency amount is in the local currency the Currency rate value returned is 0. I have used a case statement to convert the 0 to 1. (is there
easier way)

But I now can't calculate my Local amount value because of the way I have converted the currency rate.

Select IH.Amount, 'Currency Factor' = CASE
when
IH.[Currency Factor] = 0 then 1
else IH.[Currency Factor]
end,

what way should I have written this?Ya lost me...

How about some sample data and what the expected results should be...DDL would be useful as well...|||Geraldine Solved it ........

CASE
WHEN CurFctr = 0 THEN Amount
ELSE CurFctr * Amount
END AS Amount

Thanks Geraldine ... again|||Well...congrats...

Who's Geraldine?|||Wasn't Geraldine Sanford's wife?

No comments:

Post a Comment