Column utc time created
is a datetime
field of when entry was made in a table that’s updated hourly. Contains 24 entries for each day.
I want to query for same time of day across a set of days (might want all 4pm records for 10/1-10/10) but don’t want records for other times in that date range. I don’t want all 4pm records in the table (the whole month is in the table).
How to do this for both SQLite and MySQL?
3
Answers
Just filter by date and then hour:
Similar to what John K. have (SQL):
To do this portably between sqlite and mysql, you can use substr.
Avoid
between
if you might be looking for midnight times;datetime between date and date
behaves differently between mysql and sqlite. So just do<
the day after your end date.