I have two tables:
CREATE TABLE "status" (
"id" integer NOT NULL PRIMARY KEY,
"created_at" datetime NOT NULL,
"updated_at" datetime NOT NULL);
CREATE TABLE "device" (
"id" integer NOT NULL PRIMARY KEY,
"created_at" datetime NOT NULL,
"updated_at" datetime NOT NULL,
"last_status_object_id" integer REFERENCES "status" ("id"));
In the table "device", last_status_object_id references status.id.
I want to delete all status rows that are not referenced by "last_status_object_id". I can't seem to figure out how to make this happen. Can anyone help me out?