a guest Jul 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select count(messages) as nb_messages, sum(count_comments) as nb_comments from (
  2.     select cm.message_id as messages, count(comment_id) as count_comments
  3.     from client_messages as cm left join comments as c on cm.message_id=c.message_id
  4.     group by cm.message_id
  5. ) as t;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand