Timeseries with MS SQL data

Hi

i’m using the below MS sql query to fech details from my database table statusdetails with the statusid as 0 for the last 24 hours based on the Createdate column

select COUNT(*) from [dbo].[statusdetails] with(nolock) where statusid=0 and (Createdate >= GETDATE()-1 AND Createdate <= GETDATE())

how to use this in grafana so that i can get the data based on the timeseries with the time range selected form the grafana timepicker

please help me on this

Use the $__timeFilter macro function such as WHERE $__timeFilter(Createdate). See documentation for details about using the macro functions.