Created
February 25, 2013 18:51
-
-
Save hshoff/5032222 to your computer and use it in GitHub Desktop.
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 u.country, COUNT(distinct user_id), COUNT(distinct hosting_id), COUNT(*) | |
FROM users u | |
JOIN hostings h ON (u.id = h.user_id) | |
JOIN reservations r ON (u.id = r.host_id) | |
WHERE h.has_availability = '1' AND r.status = '1' AND r.created_at >= '2011-01-01' | |
GROUP BY u.country; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment