执行此查询时出现错误



我无法找到错误原因。请帮助我查询中出了什么问题

 Select
        SIHDR.[Posting Date],
        SIHDR.[Bill-to Contact No_],
        SIHDR.[Order No_],
        SILIN.[Bom Item No_],
        ISNULL(CONVERT(varchar (30),(Select Description from [Item] where No_ = SILIN.[Bom Item No_])),''),
        SILIN.[No_],
        SILIN.[Line No_],
        CONVERT(varchar (30),SILIN.[Description]),
        CONVERT(varchar (30),SILIN.[Description 2]),
        CONVERT(varchar (30),SILIN.[Description 3]),
        SILIN.[Subscription Starting Date],
        SILIN.[Subscription End Date],

        SUM(CASE WHEN SIHDR.[Currency Factor]=0 THEN SILIN.[Selling Price] ELSE SILIN.[Selling Price]) as Selling_Price_INR


        FROM  [Sales Shipment Header] as SIHDR
        INNER JOIN [Sales Shipment Line] as SILIN  on SIHDR.No_ = SILIN.[Document No_]

        enter code here

最佳答案

您的CASE需要一个END

SUM(CASE WHEN SIHDR.[Currency Factor]=0 THEN SILIN.[Selling Price] ELSE SILIN.[Selling Price] END) as Selling_Price_INR

08-27 16:07