Skip to content

Instantly share code, notes, and snippets.

@saas786
Forked from michaeltwofish/gist:2515912
Created April 28, 2012 07:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saas786/2516959 to your computer and use it in GitHub Desktop.
Save saas786/2516959 to your computer and use it in GitHub Desktop.
Left join query
SELECT *, count(client_tests.id) AS test_count FROM clients LEFT JOIN client_tests ON clients.id = client_tests.client_id GROUP BY clients.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment