select a.contractPosition.contract.id, a.contractPosition.contract.number, a.contractPosition.contract.createTs, cast(a.period Date), a.documentNumber from rtneo$Accrual a
where a.contragent.inn = '3819007903' and a.period = '2019-01-01'
group by a.contractPosition.contract.id, a.period, a.documentNumber order by a.contractPosition.contract.createTs