select c.ITEM供应商合并, c.ITEM, c.物料说明, c.SQE, c.供应商, c.PO,c.time from (select * from dbo.活动区间ITEM a where convert(varchar(10), time, 120) >= '${p3}' and convert(varchar(10), time, 120) <= '${p4}' and a.ITEM in (select ITEM from dbo.活动区间ITEM where convert(varchar(10), time, 120) >= '${p1}' and convert(varchar(10), time, 120) <= '${p2}' ${if(p5="全部","",if(p5="其他","and left(ITEM,2) NOT IN ('AA' ,'AB', 'AC' ,'AD','AE')","and left(ITEM,2)='"+p5+"'"))}) ${if(p5="全部","",if(p5="其他","and left(ITEM,2) NOT IN ('AA' ,'AB', 'AC' ,'AD','AE')","and left(ITEM,2)='"+p5+"'"))}${if(SQE="全部","","and SQE ='"+SQE+"'")}) c where c.ITEM供应商合并 not in (select 活动区间ITEM.ITEM供应商合并 from dbo.活动区间ITEM where convert(varchar(10), time, 120) >= '${p1}' and convert(varchar(10), time, 120) <= '${p2}') group by c.ITEM供应商合并, c.ITEM, c.物料说明, c.SQE, c.供应商, c.PO,c.time 需要新增一列优选供应商 从dbo.活动区间ITEM里查询 原来的意思是区分这个ITEM之前存在的 现在供应商不同了 现在同时需要查到原来的供应商 条件是convert(varchar(10), time, 120) = '2021-12-31' sqlserver服务器请问怎么修改 |