SQL Script with case and calculation
Posted on 2008-11-17
I need a SQL script that will look at two columns, determine which column is not zero and then multiply that column by a third column.
Example: Select A, B, C from mytable. On each row either B will have a non-zero value or C will, but never both. The end result is that I need to get the one non-zero value and mulitply it by column A. I currently have what is below but I cannot get the syntax right for it to allow the mulitplication. If there is a better way than the Case please let me know.
SELECT Itemnmbr,'PostingCost' =
WHEN ext_assemble_qty_posting_cost = 0.00 THEN ext_stock_qty_posting_cost