How to calculate

Posted by Bob on Stack Overflow See other posts from Stack Overflow or by Bob
Published on 2011-01-04T10:49:01Z Indexed on 2011/01/04 10:54 UTC
Read the original article Hit count: 196

Filed under:

Hi,

I hv a table like this :-

Item Qty Price A Price B abc 5 36.00 0 qwe 8 0 48.00 zxc 6 12.00 0 poi 4 10.00 0 lkj 9 12.00 0 mnb 3 0 14.00
vfr 7 0 6.00

How can I sum the value using SQL ie. if Price A is zero, it will pick Price B. The expected results will be as follows :-

Item Value abc 180.00 qwe 384.00 zxc 72.00 poi 40.00 lkj 36.00 mnb 42.00 vfr 42.00

© Stack Overflow or respective owner

Related posts about sql