I have two tables in a sqlite database like:
CREATE TABLE list (
list_id INTEGER NOT NULL PRIMARY KEY,
title TEXT NOT NULL
);
CREATE TABLE item (
item_id INTEGER NOT NULL PRIMARY KEY,
title TEXT NOT NULL,
completed INTEGER NOT NULL,
list_id INTEGER NOT NULL REFERENCES list (list_id)
);
I want to perform a query on the list table that returns the id, title and creates a variable completed
that is true
or 1 if all of the item
rows that reference it are completed otherwise false
or 0
.
I am quite new to sql (so not sure if this is even possible) but this is just a bit beyond me at the moment. Any help or pointers in the right direction would be much appreciated.