SQLite problem with select where on a view containing a 'group by'