Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. with dec as (select
  2. CASE
  3. WHEN (dec.type_id = 4 AND dec.link_declaration_id IS NOT NULL)
  4. THEN (linked.sign_date)
  5. ELSE dec.sign_date
  6. END as sign_date
  7. FROM Declaration dec
  8. LEFT JOIN Declaration linked ON dec.link_declaration_id = linked.id
  9. WHERE dec.pcard_id = :id
  10. AND (dec.status IN (3, 4, 5, 7) AND dec.status <> 10)
  11. AND (dec.court_resolution_id IN (120, 121))
  12. )
  13. select sign_date
  14. from dec
  15. where (sign_date BETWEEN :beginDate AND :endDate)
  16. order by sign_date
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement