Created
April 13, 2016 19:33
-
-
Save henryhund/94b17a40dc18220ee5673eca3ac06ac5 to your computer and use it in GitHub Desktop.
Part 4 of Lead Engagement Scoring Query: https://gist.github.com/henryhund/dc9b2d47c00f018c098c#file-lead_scoring_complete_query-sql
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
/* | |
Include Parts 1, 2 and 3 | |
*/ | |
mrr_per_activity AS | |
( SELECT total_mrr_per_activity.visit_type, | |
total_mrr_per_activity.visit_details, | |
total_mrr, | |
total_count AS total_visits, | |
round(total_mrr/total_count, 2) AS mrr_per_visit | |
FROM total_mrr_per_activity | |
LEFT JOIN count_activities ON total_mrr_per_activity.visit_details = count_activities.visit_details | |
AND total_mrr_per_activity.visit_type = count_activities.visit_type | |
ORDER BY mrr_per_visit DESC ) | |
SELECT * | |
FROM mrr_per_activity |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment