Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. with email_delpoints as
  2. (select email_from, delivery_point_id, create_date lead_date
  3. from (
  4. select email_from, delivery_point_id, create_date, rank() over (partition by email_from order by create_date desc) as rnk
  5. from email e
  6. where e.create_date >= '01-MAR-2017'
  7. --and e.create_date < '01-APR-2017'
  8. and e.email_type_id = 6
  9. and e.sec_user_login_source_id in (1,4)
  10. and e.delivery_point_id is not null) sub where rnk = 1)
  11. select *
  12. from email_delpoints ed;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement