Heyall!
Maybe you can help me with a SQL Query:
I have a conversion value in a secondary table and the following structure:
ID PRICE_BRL PRICE_USD
-- --------- ---------
1 10 5
2 12 NULL
3 NULL 3
4 14 NULL
5 NULL 4
6 NULL NULL
I need a Result Set Like that prioritizes the first column, in case of NULL, gives me the second column value multiplied by the conversion value stored in the secondary table. Something like, in pseudo-code:
SELECT
id,
(
IF (price_brl != null)
price_brl
ELSE
price_usd * tbl_2.value
) as final_price
FROM tbl_1
I think it must be simple using Joins, but I can't figure it out!
Thanks in advance.