WITH GAYLORDS AS (
	SELECT
		MIN(timestamp) AS start_timestamp,
		MAX(timestamp) AS end_timestamp,
		gaylord_id AS gaylord,
		SUM(count) AS count
	FROM gl_history
	WHERE timestamp BETWEEN :startDate AND :endDate
	GROUP BY gaylord_id
    ORDER BY gaylord_id
)
SELECT
	start_timestamp,
	end_timestamp,
    gaylord,
	/* Counts: */
	count
FROM GAYLORDS;