SELECT id, name, -- name, source, &c. are constant per id, and sqlite lets us select without aggregate source, link, image, COUNT(*) AS tokens, COUNT(DISTINCT message) AS messages, COUNT(DISTINCT sender) AS senders FROM emote WHERE channel = :channel AND time BETWEEN :start AND :end GROUP BY id