Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- dp.document.id
- from DocumentPacket dp
- where ((dp.document.documentType = :mainDoc and dp.document.documentModeId = :documentModeId)
- or (dp.document.documentType = :container
- and exists(select dc from DocumentContainer dc
- where dc.containerId = dp.document.id and dc.documentModeId = :documentModeId)))
- and dp.packet.ogrn = :ogrn and dp.processingMillis >= :from and dp.processingMillis < :to
- group by dp.document.id order by min(dp.document.processingMillis) desc, dp.document.id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement