Advertisement
Guest User

Untitled

a guest
Aug 14th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.39 KB | None | 0 0
  1. SELECT
  2.   w.id AS watch_id,
  3.   w.social_id as social_id,
  4.   COUNT(social_id) as watchers
  5. FROM
  6.   watches w
  7.   INNER JOIN livedune.users u ON u.id = w.user_id
  8.   INNER JOIN livedune.user_access a ON a.user_id = u.id AND a.access = 'business'
  9. WHERE
  10.   w.is_linked = 1
  11.   AND w.type = 'instagram_new'
  12.   AND w.comments_enabled = 1
  13.   AND a.end < DATE_SUB(NOW(), INTERVAL 7 DAY)
  14. GROUP BY
  15.   social_id
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement