/gist:404797e2c6c5fbbd01c3 Secret
Created
February 9, 2014 12:13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
r1.destination AS file_id, | |
count(r2.id) AS subrelations, | |
octet_length(f.contents) AS bytes, | |
r1.name AS name | |
FROM | |
relations AS r1 | |
INNER JOIN | |
files AS f ON f.id = r1.destination | |
LEFT OUTER JOIN | |
relations AS r2 ON r2.source = r1.destination | |
WHERE | |
r1.source = ? | |
GROUP BY | |
r1.name, | |
r1.destination, | |
f.contents | |
ORDER BY | |
r1.name ASC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment