SQLize Online / PHPize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
select kodexp,otmsint1,otmsint2 into #ww from docum where sdan=0 and (id_exp=2 and tip_exp=7) and otmsint1>700 and kodexp in (select codexp from reestrexpnov where sl1+sl2+sl3+sl4=0 group by codexp having count(*)>0) select distinct r.sn_pol,ump,codexp into #ww1 from reestrexpnov r inner join #ww on r.codexp=#ww.kodexp inner join schetosn s on r.sn_pol=s.sn_pol and r.lpu_id=s.lpu_id inner join rstrnew rr on s.cod=rr.cod and s.otms=rr.otms where s.otmsint>=#ww.otmsint1 and s.otmsint<=#ww.otmsint2 and failed=0 and e_cod=7 update reestrexpnov set sl1=(select count(*) from #ww1 where #ww1.codexp=reestrexpnov.codexp and #ww1.sn_pol=reestrexpnov.sn_pol and #ww1.ump=1) where codexp in (select codexp from #ww1) update reestrexpnov set sl2=(select count(*) from #ww1 where #ww1.codexp=reestrexpnov.codexp and #ww1.sn_pol=reestrexpnov.sn_pol and #ww1.ump=2) where codexp in (select codexp from #ww1) update reestrexpnov set sl3=(select count(*) from #ww1 where #ww1.codexp=reestrexpnov.codexp and #ww1.sn_pol=reestrexpnov.sn_pol and #ww1.ump=3) where codexp in (select codexp from #ww1) update reestrexpnov set sl4=(select count(*) from #ww1 where #ww1.codexp=reestrexpnov.codexp and #ww1.sn_pol=reestrexpnov.sn_pol and #ww1.ump=4) where codexp in (select codexp from #ww1) drop table #ww drop table #ww1 update reestrexpnov set sl3=1 where sl3=0 and codexp in (select kodexp from docum where id_exp=8 and tip_exp=155 and otmsint1>700) update reestrexpnov set sl3=1 where sl3=0 and codexp in (select kodexp from docum where id_exp=9 and tip_exp=156 and otmsint1>700) update reestrexpnov set sl1=1 where sl1=0 and codexp in (select kodexp from docum where id_exp=8 and tip_exp=203 and otmsint1>700)
Stuck with a problem? Got Error? Ask ChatGPT!
Copy Clear