Skip to content

Instantly share code, notes, and snippets.

@neverpanic
Created March 29, 2011 14:57
Show Gist options
  • Select an option

  • Save neverpanic/892491 to your computer and use it in GitHub Desktop.

Select an option

Save neverpanic/892491 to your computer and use it in GitHub Desktop.
SELECT
r.correlation_id
, r.version_name
, r.version
, count(f.file_id) as count
, min(f.version)
, max(f.version)
FROM
reports r
LEFT JOIN
files f
ON
f.file_id = r.file_id
GROUP BY
r.correlation_id
ORDER BY
count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment