Skip to content
Advertisement

getting error in Sql Query incorrect syntax near ‘)’ [closed]

I getting the error when I execute this query

Msg 102, Level 15, State 1, Line 15 Incorrect syntax near ‘)’.

I am unable to find the cause of error .please help what is wrong in my query

 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

Advertisement

Answer

Your CASE needs an END

SUM(CASE WHEN SIHDR.[Currency Factor]=0 THEN SILIN.[Selling Price] ELSE SILIN.[Selling Price] END) as Selling_Price_INR
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement