added a where statement to sqlite query