Here are some queries I'm making and the results I'm receiving. What I开发者_运维技巧'm trying to end up with is a list of months and years. So I want to see a result of 02-2011, 03-2011, 04-2011. But I can't seem to get it... what should I do?
select date from record;
04-13-2011
04-14-2011
03-14-2011
02-14-2011
sqlite>
select strftime('%m-%Y') from record;
04-2011
04-2011
04-2011
04-2011
sqlite>
select date from record group by date('%m-%Y');
02-14-2011
sqlite>
select strftime('%m-%Y', date) from record group by date('%m-%Y');
note: blank row
sqlite>
Maybe
select substr(date,0,5) from record;
Your date seems to be a string column. Anyway, in the second query you select current month and year for each row, the same goes for GROUP BY
clause of subsequent queries.
精彩评论