Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (CountCurrent - CountLastMonth) / CountLastMonth
- activity, upload_date
- SELECT
- Y.CurrentMonth, Y.CountCurrent,
- Z.LastMonth, Z.CountLastMonth
- FROM
- (SELECT
- upload_date,
- activity,
- DATE_FORMAT(upload_date,'%M %Y') AS CurrentMonth,
- COUNT(activity) AS CountCurrent
- FROM appmaster
- WHERE activity = 'com.google.test'
- GROUP BY DATE_FORMAT(upload_date,'%m%y'))
- Y INNER JOIN
- (SELECT
- activity,
- DATE_FORMAT(upload_date,'%M %Y') AS CurrentMonth2,
- DATE_FORMAT(upload_date - INTERVAL 1 MONTH,'%M %Y') AS LastMonth,
- COUNT(activity) AS CountLastMonth
- FROM appmaster
- WHERE activity = 'com.google.test'
- GROUP BY DATE_FORMAT(upload_date - INTERVAL 1 MONTH,'%m%y'))
- Z ON Z.CurrentMonth2 = Y.CurrentMonth
- GROUP BY DATE_FORMAT(upload_date,'%Y%m')
- ORDER BY DATE_FORMAT(upload_date,'%Y%m')
- SELECT b.CurrentMonth, sum(b.CountCurrent), b.LastMonth
- FROM (SELECT DATE(a.upload_date - INTERVAL 1 MONTH) AS LastMonth, DATE(a.upload_date) AS CurrentMonth, COUNT(a.activity) AS CountCurrent
- FROM appmaster a WHERE a.activity = 'com.google.android.googlequicksearchbox'
- group BY MONTH(a.upload_date)) AS b
- group BY MONTH(b.CurrentMonth)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement