SQLite Forum


2 forum posts by user Superfar

10:07 Reply: Week numbers in queries (artifact: efb069dc56 user: Superfar)

Yes! I knew I was doing something stupid. I am a seasoned firmware-programmer but a complete rookie with databases, and the type-system is a little different from what I am used to in C/C++. Thank you so much :-)

22:20 Post: Week numbers in queries (artifact: d9095ecd10 user: Superfar)
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?