Templating a different MySQL value

If I understand correctly, you want 1) a template variable with hard coded values “5, 15, 30 min and 4hour and 1 day” and 2) you want to use it in your sql query.

  1. Create a custom variable:

  1. Use it in the where clause (the template variable is called custom but you can name it to what ever you want):
SELECT
  UNIX_TIMESTAMP(r.created_at) as time_sec,
  r.`rsi_5_min` as value,
  e.name as metric
FROM ...
WHERE $__timeFilter(r.created_at) AND r.`rsi_5_min` = $custom