Nolan
Nolan

Reputation: 75

sqlite, selecting number of unique values for each month

I am relatively new to sqlite and I am trying to count the number of unique stores each month in my table. My query looks like this:

SELECT COUNT(DISTINCT Store_Num) FROM 'heroes' WHERE strftime('%y-%m', Date)='2005-01';

however it is returning 0 each time. I think it may have to do with my strftime syntax, but I have gone through the documentation and am unable to figure it out.

Thanks!

Upvotes: 0

Views: 40

Answers (1)

Uppercase "Y". strftime('%Y-%m', Date)

sqlite> select strftime('%Y-%m', dt) from test;
2014-01

Upvotes: 1

Related Questions