Try sqlite subqueries