SELECT ExchangeRatePrice = CASE pp.Price
WHEN NULL THEN 0
ELSE (CASE WHEN c.CurrencyId = 1 THEN pp.Price
ELSE CONVERT(DECIMAL(9, 2), (pp.Price * c.ExchangeRate)) END)
END ,
price as OriginalPriceInDB,
10 * Price as CalculatedPrice,
c.currencyid as Currency
FROM ProductPrice pp, currency c
I want calculated column (ExchangeRatePrice) to use in CalculatedPrice. Can I use it straight of I need to convert it again?
I have used 10 * Price just to show you the example because if I use 'ExchangeRatePrice' here it will give error 'Invalid Column name'