SQLite Forum

Week numbers in queries
Login
Hi All
I am trying to build a query that returns all records from a specific week number. I could not get it to work, so I have narrowed it down to this:

SELECT strftime('%W', StartTime, 'unixepoch', 'localtime') 
FROM Records 
WHERE  strftime('%W', StartTime, 'unixepoch', 'localtime') <> 17;

which should return the week number of all records *not* started in week 17. However, it matches 5 records and all 5 returns a week number of 17! Looks like the strftime returns 17 in the SELECT part and something else in the WHERE part. I don't believe that so chances are I am doing something stupid here. Can anyone please tell me how to do this right?

Br
Morten