Time range in sql query

am having a table in sql server with data and created on field with a date variable in UNIX epoch format.

I need to execute a query like

select * from tablename where created on > dynamic date and created on < dynamic date.

Is it possible to take this dynamic date variable content from the date picker available at the top right counter.

There won’t be any records where the timestamp is both greater than the date and less than it.

I’m pretty sure the OP meant two different dynamic dates as lower and upper
boundaries for the query.


In that case I don’t understand what that means. It might help if the OP explained exactly what he is trying to do.

want to execute a query with upper and lower date limit.
Example a query which gives me all the records between two dates and these dates should be dynamically taken from date picket option available in grafana and this query is against a table in sql server

The date picker lets you select the range you want, so I still don’t understand what is different to the normal operation of the panel. Are you talking about the Graph panel?

Give us an example of exactly what you mean by “these dates should be
dynamically taken from date picker option”.


The dates selected I want to use them as variables in my sql select query

So, maybe __from and __to are what you’re looking for?



Thanks that worked perfectly.