MyTetra Share
Делитесь знаниями!
Запрос выбирает контрагентов у которых принято хоть одно доп соглашение
Время создания: 20.11.2019 11:02
Раздел: INFO - JOB - CUBA - SQLScripts
Запись: wwwlir/Tetra/master/base/1574218945po667my76g/text.html на raw.githubusercontent.com

select c.name, c.inn, c.legalAddress, (select c2.number from rtneo$Contract c2 where c2.contragent.id = c.id and c2.createTs = (select max(c3.createTs) from rtneo$Contract c3 where c3.contragent.id = c.id and c3.mainContract is null)) from rtneo$Contragent c where (select count(c1) from rtneo$Contract c1 where c1.contragent.id = c.id and not c1.mainContract is null and c1.accepted = true and (c1.mainContract.loadedFromBigTrio = false or c1.mainContract.loadedFromBigTrio is null))>0

 
MyTetra Share v.0.59
Яндекс индекс цитирования