Add DISTINCT to sqlite query