Created
February 6, 2015 21:16
-
-
Save ZeroStride/2dcf45e495d2f86e8c2f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| WITH PlayedQuery AS( | |
| SELECT count(*) AS Played, a_title AS Title, event_type FROM AWSMA.event | |
| WHERE event_type='Gif_Played' GROUP BY a_title,event_type | |
| ), | |
| CompletedQuery AS( | |
| SELECT count(*) AS Shared, a_title AS Title2, event_type FROM AWSMA.event | |
| WHERE event_type='Share_Completed' GROUP BY a_title,event_type | |
| ), | |
| CanceledQuery AS( | |
| SELECT count(*) AS Canceled, a_title AS Title3, event_type FROM AWSMA.event | |
| WHERE event_type='Share_Canceled' GROUP BY a_title,event_type | |
| ) | |
| SELECT Title, Played, Shared, Canceled FROM( | |
| SELECT * FROM PlayedQuery | |
| INNER JOIN(SELECT * FROM CompletedQuery) ON (PlayedQuery.Title = Title2) | |
| INNER JOIN(SELECT * FROM CanceledQuery) ON (PlayedQuery.Title = Title3) | |
| ) ORDER BY Shared DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment