Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. select count(*) from (
  2. select * FROM social_shares s JOIN news_items n ON s."news_item_UID" = n."UID"
  3. WHERE category = 'test'
  4. AND
  5. (n.claimed_timestamp >= now() - INTERVAL '24 hours' AND s.last_update_at < now() - INTERVAL '5 minutes')
  6. UNION ALL
  7. SELECT * FROM social_shares s JOIN news_items n ON s."news_item_UID" = n."UID"
  8. WHERE category = 'test'
  9. AND s.last_update_at IS null
  10. )q;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement