Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 Microsoft VS 2010 中有一份报告。它包含各种字段。其中一个字段是订单类型。其他字段之一是 Quantity Sold。如果订单类型是某个值,我希望能够将 Quantity Sold 值设为负数。最好的方法是什么?
这将在某些情况下否定该值:
select OrderType, case when OrderType = 42 then -QuantitySold else QuantitySold end as QuantitySold from StuffThatWasSold