Auto generated query not working I'm testing knowage system, my backend is MSSQL while knowage server is my sql. 
I found on dataset audit log this query:

select "ATC_1" AS "ATC_1",  SUM("Importo_Scarto") AS "Importo_Scarto", SUM("Q_Scarto") AS "Q_Scarto"
from (SELECT 
      [ATC_1]
      ,[MESE]
      ,[ANNO]
      ,[Q_Scarto]
      ,[Importo_Scarto]
  FROM [dbo].[MyTable]) T  
  where (("ANNO","MESE") IN ('2017','10'),('2017','11'),('2018','01'),('2018','02'),('2018','03')
  and ("Invio") IN ('3'),('1'),('2') )
  group by "ATC_1"


the error I get is this:


  com.microsoft.sqlserver.jdbc.SQLServerException: An expression of non-boolean type specified in a context where a condition is expected, near ','
The condition:

where ( ("ANNO","MESE") IN ('2017','10'),('2017','11'),
                           ('2018','01'),('2018','02'),('2018','03')
   and  ("Invio") IN ('3'),('1'),('2') 
      )


has 2 issues:


first, it needs parentheses around the IN lists (and the ones you have around the two sub-conditions are redundant):

where   ("ANNO", "MESE") IN ( ('2017','10'), ('2017','11'),
                              ('2018','01'), ('2018','02'), ('2018','03')
                            )
   and  "Invio" IN ( '3', '1', '2' ) 

second, even if you fix the above, it won't work in SQL Server as this type of syntax (the first sub-condition, that combines IN with tuples) has not yet been implemented. You can rewrite in various ways, eg. using a JOIN and VALUES syntax:

from
      ( ...
      ) T  
    join
      ( values ('2017','10'), ('2017','11'), 
               ('2018','01'), ('2018','02'), ('2018','03') 
      ) as V ("ANNO", "MESE")
    on
      V."ANNO" = T."ANNO" and V."MESE" = T."MESE"
where  "Invio" IN ( '3', '1', '2' ) 
---

by the way, the subquery (aliased T) is not really needed. It ony adds complexity for those trying to read it:

select 
    T."ATC_1",
    SUM(T."Importo_Scarto") as "Importo_Scarto",
    SUM(T."Q_Scarto") as "Q_Scarto"
from 
      dbo.[MyTable] as T  
    join 
      ( values ('2017','10'), ('2017','11'), 
               ('2018','01'), ('2018','02'), ('2018','03') 
      ) as V ("ANNO", "MESE")
    on
      V."ANNO" = T."ANNO" and V."MESE" = T."MESE"
where 
    T."Invio" in ( '3', '1', '2' ) 
group by
    T."ATC_1" ;