I was trying to do this:
SELECT SUM(p开发者_StackOverflow社区rice) as total FROM ticketLine WHERE dateRegistered > '2011-07-16 17:00:00'
The idea is (was) to get a total for all lines from 17:00 till now but I get a grand total for all lines. The where clause has no effect. I googled how to do a filter on a timestamp but got no relevant info.
Can you point out what I'm doing wrong here?
Sorry it took so long to answer this but here is the way to do it:
SELECT SUM(price) as total FROM ticketLine WHERE dateRegistered > DATETIME('2011-07-16 17:00:00')
Not sure(I have never used SQLite, but I worked with MySQL and SQL Server), but there shoud be some functions to work with dates and time Try this
SELECT SUM(price) as total FROM ticketLine WHERE strftime('%s', dateRegistered) > strftime('%s', '2011-07-16 17:00:00')
I hope it is helpfull.
精彩评论