Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with dec as (select
- CASE
- WHEN (dec.type_id = 4 AND dec.link_declaration_id IS NOT NULL)
- THEN (linked.sign_date)
- ELSE dec.sign_date
- END as sign_date
- FROM Declaration dec
- LEFT JOIN Declaration linked ON dec.link_declaration_id = linked.id
- WHERE dec.pcard_id = :id
- AND (dec.status IN (3, 4, 5, 7) AND dec.status <> 10)
- AND (dec.court_resolution_id IN (120, 121))
- )
- select sign_date
- from dec
- where (sign_date BETWEEN :beginDate AND :endDate)
- order by sign_date
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement