home / dec-2024

complaint_latest (view)

✎ View and edit SQL

This data as json

0 records

CREATE VIEW complaint_latest AS
SELECT s.*
FROM complaint_snapshots AS s
WHERE s.snapshot_pk = (
    SELECT s2.snapshot_pk
    FROM complaint_snapshots AS s2
    WHERE s2.complaint_id = s.complaint_id
    ORDER BY s2.scraped_at DESC, s2.snapshot_pk DESC
    LIMIT 1
);
Powered by Datasette · Queries took 56.826ms