Skip to content

Instantly share code, notes, and snippets.

@kru
Last active August 27, 2020 19:16
Show Gist options
  • Save kru/566c041618d67cc5d03c9ef2075a3f2a to your computer and use it in GitHub Desktop.
Save kru/566c041618d67cc5d03c9ef2075a3f2a to your computer and use it in GitHub Desktop.
SELECT (AVG(TIME_TO_SEC(TIMEDIFF(`lead_routings`.`claimed_at`, `lead_routing_agent`.`notified_at`)))) from `lead_routings` JOIN `lead_routing_agent` ON `lead_routing_agent`.`lead_routing_id` = `lead_routings`.`id` WHERE `lead_routings`.`route_team_id` = :team_id AND `lead_routing_agent`.`notified_at` IS NOT NULL AND `lead_routings`.`claimed_by_kwuid` = :kwuid;
SELECT (AVG(TIME_TO_SEC(TIMEDIFF(`lead_routings`.`first_interaction_at`, `lead_routings`.`claimed_at`)))) from `lead_routings` WHERE `lead_routings`.`route_team_id` = :team_id AND `lead_routings`.`interaction_at` IS NOT NULL AND `lead_routings`.`claimed_by_kwuid` = :kwuid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment