Hi, I have this query but I miss an error saying that parentheses are missing right:
select to_char(trunc(fecha,'HH')+(30*round(to_char( trunc(fecha,'MI'),'MI')/30))/1440,'DD/MM/YYYY hh24:mi:ss') AS fecha, SUM(total) AS total
from (SELECT FECHA_CREACION AS FECHA, Count(FECHA_CREACION) AS TOTAL
FROM ROBOT_CONTEO_CONSULTA
GROUP BY FECHA_CREACION)
WHERE fecha BETWEEN TO_DATE(:fechaDesde,'DD/MM/YYYY hh24:mi:ss') AND TO_DATE(:fechaHasta, 'DD/MM/YYYY hh24:mi:ss')
GROUP BY to_char(trunc(fecha,'HH')+(30*round(to_char( trunc(fecha,'MI'),'MI')/30))/1440,'DD/MM/YYYY hh24:mi')
ORDER BY fecha ASC;
The error is in the range of dates of the between, I am passing by parameters the date From and the date Until, if I do for example in the where:
WHERE fecha BETWEEN CURRENT_DATE-20 AND CURRENT_DATE
It's perfect, so I do not understand what's wrong, if I do this: (which is what I'd like to do)
WHERE fecha BETWEEN :fechaDesde AND :fechaHasta
He tells me that a keyword is missing, some idea, I need it so I can define it as a view. Pdta: this query brings me the total of consultations in half hour sections.