[Solved] Slightly Complicated SQL query


Something like this should return the specified resultset:

 SELECT u.id AS user_id
      , u.user_name
      , SUM(a.user_id IS NOT NULL) AS total_count_of_articles
   FROM users u
   LEFT
   JOIN users_articles a
     ON a.user_id = u.id
  GROUP BY u.id, u.user_name
  ORDER BY total_count_of_articles DESC

2

solved Slightly Complicated SQL query