Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.52 KB | None | 0 0
  1. select
  2.     dp.document.id
  3.         from DocumentPacket dp
  4.             where ((dp.document.documentType = :mainDoc and dp.document.documentModeId = :documentModeId)
  5.                 or (dp.document.documentType = :container
  6.                         and exists(select dc from DocumentContainer dc
  7.                             where dc.containerId = dp.document.id and dc.documentModeId = :documentModeId)))
  8.                     and dp.packet.ogrn = :ogrn and dp.processingMillis >= :from and dp.processingMillis < :to
  9.     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