Filter between Times, not Dates

I have a query in mssql which returns a record set with the hour (as time datatype) at which the record occurred. I would like to use a field filter to show a list of the available time hours (I have created a table just for storing hours in the day, joined that table to my record set) and apply a BETWEEN clause to my record set so that I can return the records which occurred between specific times on those dates. This is a workaround for issue #7418. However, when using a datetime filter widget I can only select dates hence my hope that I could use a field filter with a between clause. Is there any way to work around the issue that native sql queries cannot filter by time?

Hi @ChristineChetty

Just for reference for others:
https://github.com/metabase/metabase/issues/7418 - upvote by clicking :+1: on the first post

So it would be possible to do that by creating a sub-select, where you only return one value, and then you would create two of those for beginning and end, but looking at the rest of your query it seems like it would require a lot of modelling, so I would probably recommend just using two Number filters, which you might be able to work into your query more easily.

1 Like