kaiyan/emote/sqlitestore/metrics.sql
2025-04-20 10:45:32 -04:00

13 lines
304 B
SQL

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