sqlite make variable from subquery count -
i have 2 tables in 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 perform query on list table returns id, title , creates variable completed
true
or 1 if of item
rows reference completed otherwise false
or 0
.
i quite new sql (so not sure if possible) bit beyond me @ moment. or pointers in right direction appreciated.
assuming completed
on item
table 1 or 0.
select l.list_id ,l.title ,max(i.completed) list l left outer join item on i.list_id = l.list_id group l.list_id ,l.title
Comments
Post a Comment