Hi Fellows, As you can see, I'm giving you a bit of work. select codProduct, quantity, if negociatedValue > 0 then (or is not null) negociatedValue * quantity else standardValue * quantity from sales ... |
I would prefer the isnull() function - or coalesce(), which works the same here but is standard SQL: select codProduct, quantity, isnull(negociatedValue, standardValue) * quantity from sales ... |
This might work: select codProduct, quantity, if negociatedValue > 0 then (or is not null) negociatedValue * quantity else standardValue * quantity endif from sales ... |
I just found a way to do it, but with case and using alias, like ...
select codProduct, quantity, case when negociatedValueis not null then negociatedValue * quantity else standardValue * quantity end from sales ...