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 timeline_items.* FROM ( | |
# Query 1 | |
SELECT lead_alerts.id AS id, lead_alerts.action AS body, users.first_name AS first_name, users.last_name AS last_name, lead_alerts.due_on AS date, "lead_alerts" AS model | |
FROM `lead_alerts` LEFT OUTER JOIN `users` ON `users`.`id` = `lead_alerts`.`author_id` | |
WHERE `lead_alerts`.`lead_id` = 1 | |
UNION ALL | |
# Query 2 | |
SELECT completed_lead_alerts.id AS id, lead_alerts.action AS body, users.first_name AS first_name, users.last_name AS last_name, completed_lead_alerts.completed_on AS date, "completed_lead_alerts" AS model |