Add a query for finding most recent appearance by caster

This commit is contained in:
gg1234 2024-03-13 08:25:52 -07:00
parent 96038bef34
commit 745daf3da0
1 changed files with 10 additions and 0 deletions

View File

@ -214,6 +214,16 @@ SELECT DATE(jst) AS dt,
HAVING c > 1
ORDER BY dt DESC;
-- Caster's Last Appearance
SELECT c.n AS name,
MAX(s.jst) AS last_appearance,
JULIANDAY(DATETIME('now', '+09:00')) - JULIANDAY(MAX(s.jst)) AS days_since
FROM schedule s
JOIN caster c ON c.id = s.caster_id
WHERE s.jst < REPLACE(DATETIME('now', '+09:00'), ' ', 'T')
GROUP BY c.n
ORDER BY last_appearance DESC;
-- MANUAL FIXES
-- copy matsu's cancelled coffee time to cancellation table