Skip to content

Instantly share code, notes, and snippets.

@michaeltwofish
Created April 28, 2012 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save michaeltwofish/2515912 to your computer and use it in GitHub Desktop.
Save michaeltwofish/2515912 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