update bwptest1.sys_item_list set SUBSELECT_SQL = '{select case when (select * from UserHasAction(%CurrentUserID%,'23,24,146,148'))=1 then sql1||'where 1=1' when (select * from userhasaction(%CurrentUserID%,'25,28,147'))=1 then sql1||' where b.are_id = ''' || %DataAreaID% || '''' when (select * from userhasaction(%CurrentUserID%,'88,89'))=1 then sql1||' where b.districtid in(' || %DataDistrictID% || ')' when (select * from userhasaction(%CurrentUserID%,72))=1 then sql1||'where a.sho_id in (%_mul_ShopStr%)' else sql1||'where a.sho_id ='''|| %DataShopID%||'''' end bieming from (select ' select b.are_id, c.are_name, b.districtid, d.districtname, a.Sho_ID, a.bra_Id, case when b.createtime >= to_date(to_char(current_date,''YYYY'')) then ''是'' else ''否'' end ISNEWSHOP, a.WhenDate, a.DealCount, a.saleamount, a.salemoney, a.deductmoney from (select Sho_ID, WhenDate, bra_id,(DealCount) DealCount, (saleamount) saleamount, (salemoney) salemoney, (deductmoney) deductmoney from shop_day_bra_sales a where (WhenDate between @startdate@ and @enddate@ or WhenDate between @CompareStartDate@ and @CompareEndDate@ ) ) a inner join shop b on a.sho_id = b.sho_id left join area c on b.are_id = c.are_id left join districtlist d on b.districtid = d.districtid ' sql1 from dummy ) } ' where ITEM_ID = '200707'; 能不能帮看一下 |