Skip to content

Instantly share code, notes, and snippets.

@rgarner
Created April 8, 2014 14:01
Show Gist options
  • Save rgarner/10128683 to your computer and use it in GitHub Desktop.
Save rgarner/10128683 to your computer and use it in GitHub Desktop.
Worst things first things
SELECT m.path,
Sum(h.count) AS hit_count
FROM mappings m
INNER JOIN sites s
ON m.site_id = s.id
LEFT JOIN hits h
ON h.mapping_id = m.id
WHERE s.id = 50
GROUP BY m.path_hash
ORDER BY hit_count DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment