nyazoom/queries/records/get_expired_records.sql

7 lines
250 B
SQL

SELECT
id,
cache_name,
downloads >= max_downloads AS "out_of_downloads: bool",
julianday('now') - julianday(uploaded) > 5 AS "too_old: bool"
FROM records
WHERE downloads >= max_downloads OR julianday('now') - julianday(uploaded) > 5;