SQLite Forum

SQL query help for between times and grouping times
Login
>This doesn't work:

But this one does although possibly not in way you would expect. Your time string has a space preceding the 8. Include that space and rows are returned. 

SELECT EventTime,
       Count(EventTime) AS count
FROM   trafficdata
WHERE  EventTime between ' 8:%%:%% PM' and '10:%%:%% PM'
GROUP  BY EventTime;

The preceding comments about using proper date and time formats are a much preferred solution