Created
April 4, 2015 15:39
-
-
Save s2t2/a68ee869b448311c929b to your computer and use it in GitHub Desktop.
branford station database queries -- https://github.com/s2t2/branford_station
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
-- HOSTED FEEDS (row per feed) | |
SELECT | |
f.id AS feed_id | |
-- ,f.name AS feed_name | |
,f.source_url AS feed_source_url | |
,h.id AS host_id | |
,h.name AS host_name | |
,v.last_modified_at AS feed_last_modified_at | |
-- ,v.etag AS feed_last_modification_etag | |
,v.last_checked_at AS feed_last_checked_at | |
FROM feed_hosts h | |
JOIN feeds f ON f.host_id = h.id | |
JOIN ( | |
-- FEED LAST MODIFIED AT (row per feed) | |
SELECT | |
feed_id | |
,max(last_modified_at) AS feed_last_modified_at | |
FROM feed_versions | |
GROUP BY feed_id | |
) lm ON lm.feed_id = f.id | |
JOIN feed_versions v ON lm.feed_id = v.feed_id AND v.last_modified_at = lm.feed_last_modified_at |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment