Absolute Time Range in SQL Query

Hello,

I am new to creating Grafana dashboard. I have a table in the dashboard with a SQL Query.
I want to use the time selector at the top right in Grafana in the SQL query so that only data in that time is shown. Could someone please help with this.

My Query is structured as followed:

SELECT char_value , time_stamp
FROM table_name
WHERE tag = ‘tagname’
AND time_stamp > subtractSeconds(now(), 300)
ORDER BY time_stamp DESC

I want to change the selected sentence in query to filter time as per time range selector.

I have tried $timeFIlter but it looks like that doesn’t work for tables. Please let me know if you have a solution

Hi @tanyasharma,

Welcome to the :grafana: community support forums !!

We are excited that you joined our OSS community. Please read about some of the FAQs in the community :slight_smile:

Since you did not specify what exactly is your Data source e.g. MySQL, MSSQL, etc. But we do have documentation about these Data sources where you can see how to use Timepicker in the query editor.

Here are the links

1- For MySQL:


2- For MSSQL:

I hope this helps.