我正在尝试计算一个字段。例如
select **sum(New)** as NewCST where WHERE PO ='L22411301' AND ItemNo IN('1730','1343').
而不是总和,我有整个案例陈述来实现。我还没有做过有这么多条件的公式计算。所以任何帮助表示赞赏。
到目前为止,我得到了这个:
SELECT *
FROM (SELECT
Case
When PO_SIZE like ‘%lb%’ Then CONVERT(decimal(13,4), NET_COST / TOTAL_WEIGHT)
When PO_SIZE like ‘%LB%’ Then CONVERT(decimal(13,4), NET_COST / TOTAL_WEIGHT)
Else CONVERT(decimal(13,4), ADJ_EXT_NET_COST / LINE_QUANTITY)
from [FirstStrike_Retail].[custom].[Whse_Line_Item] )End AS NewCst.
WHERE PO ='L22411301' AND ItemNo IN('1730','1343')