I have a table cost, with costs of products from one colum(cost). This column has has different currency values e.g dollars, and pounds. i need to show two other columns on the right of column cost. 1st Column with dollars after converting., and 2nd Column with Pound value after converting.
The conversion for different currencies are in another table called currencyt. each row has currency id,curreny name, currency equivalent to dollars(eg. currency id=2,curreny name=pounds and currency equivalent to dollars=1.8 )
How can i do that in a storage procedure.
I tried to use the below storage procedure but display alot of duplicate.
select t1.Product_Name as Item ,t1.Description as Description ,
t5.Currency as Currency,t1.stock_quantity as Quantity,t4.unit_price as Unit_Cost,
t1.stock_quantity*t4.unit_price as Total_Cost, t1.stock_quantity* xx.unit_price_rate
from Product t1,section t2,Department t3,Entry_New t4,Currency t5,
when t9.id in (3,1) then
t8.unit_price * t9.Rate
End As unit_price_rate
from Currency t9,Entry_New t8,Product t10
where t9.id=t8.currency and t10.Product_ID=t8.Product_ID)xx
where t1.section_ID=t2.section_ID and t2.Department_ID=t3.Department_ID and t1.Product_ID=t4.Product_ID and t5.id=t4.currency
Any help will be much appreciated. Thanks