this case statement does not return the result i'm expecting the value of wq.quantity_on_hand = 156, im.last_repack_item = 0, im.freight_item = .38010 ( Case when im.last_repack_item = 0 then wq.quantity_on_hand * ( im.last_repack_item + im.freight_item ) else 0 END ) repack_cost, the select returns 59.2956 (156 * .38010) i thought it should return 0 i've worked around it by creating multiple columns, but i'd like to know if it's a bug, or if it's the way it's supposed to work. thanks Tom M. asked 03 May '13, 11:19 Tom Mangano Volker Barth |
Why would you expect the expression to return 0? The expression 'im.last_repack_item = 0' evaluates to TRUE since you tell us that last_repack_item is zero, so the value of the 'then' clause is returned. answered 03 May '13, 11:23 Mark Culp 1
i've looked at it for 15 mins, checked values, etc. i'm in the office by myself today, so thanks for looking over my shoulder.
(03 May '13, 11:33)
Tom Mangano
|