Skip to content

Instantly share code, notes, and snippets.

@cleytonmessias
Created September 5, 2014 18:58
Show Gist options
  • Save cleytonmessias/ecb11d2648c21c60d0d5 to your computer and use it in GitHub Desktop.
Save cleytonmessias/ecb11d2648c21c60d0d5 to your computer and use it in GitHub Desktop.
SELECT
A.name
, COUNT(distinct A.id) AS 'total'
FROM
products AS A
INNER JOIN
questions AS B
ON
A.id = b.product_id
GROUP BY
A.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment