I need query a date range (Last week, Last month, last six month, last year, etc) in MySQL Database. Have a dashboard that showes informations of calls survey in PBX.
Thinked use a “Interval” variable, but the interval’s is 1h, 1m, 1y,… and don’t know how convert this to date, to execute query.
Other idea is insert two variables box to insert start and end date, but grafana don’t have “mask” in fields. Is correctly this afirmation?
Can anywone helpe me to solve this?
PS: Sorry, I don’t speak fluently english
See below prints:
See my select returning “today” data:
SELECT DataHora, NumeroAvaliador, NotaAvaliacao FROM TBAvaliacoes where EmpresaAvaliacao = 1 and YEAR(DataHora) = year(now()) and Month(DataHora) = month(now()) and day(DataHora) = day(now()) and RamalAvaliado = $Ramal and NotaAvaliacao <= '5' order by DataHora desc