: [], m

Error in SQL query: ERROR: date/time field value out of range: "0-01-01 00:00:00" LINE 1: ...al_horas from calendario_hora where ch_fechahora>='0-01-01 0... ^ HINT: Perhaps you need a different "datestyle" setting. Query:select *,('CGRTA2∫ervalohora') as s_cod,(coalesce(cant_horas*(24/24),0)*100/cant_total_horas) as data_pc from (select min(ch_fechahora) as fecha ,count(*) as cant_total_horas from calendario_hora where ch_fechahora>='0-01-01 00:00:00' and ch_fechahora<='0-12-31 23:59:59' group by extract(year from ch_fechahora),extract(month from ch_fechahora) order by extract(year from ch_fechahora),extract(month from ch_fechahora)) as qhora1 left join (select min(si_fecha_gmt4) as si_fecha_gmt4,min(si_min) as si_min,avg(si_min) as si_mindia_avg,avg(si_prom) as si_prom,avg(si_max) as si_maxdia_avg,max(si_max) as si_max,sum(cant_horas) as cant_horas from (select min(si_fecha_gmt4) as si_fecha_gmt4,min(si_min) as si_min,avg(si_prom) as si_prom,max(si_max) as si_max,sum(cant) as cant_horas from (select 'CGRTA2∫ervalohora' as s_cod,min(si_fecha_gmt4) as si_fecha_gmt4,min(si_min) as si_min,avg(si_prom) as si_prom,max(si_max) as si_max,1 as cant from sensor_informe_x_b where s_cod='CGRTA2∫ervalohora' and si_fecha_gmt4>='0-01-01 00:00:00' and si_fecha_gmt4<='0-12-31 23:59:59' and si_min<>'NaN' and si_prom<>'NaN' and si_max<>'NaN' and si_estado < 2 group by date (si_fecha_gmt4),extract (hour from si_fecha_gmt4)) as si group by date(si_fecha_gmt4) ) as si group by extract(year from si_fecha_gmt4),extract(month from si_fecha_gmt4)) as qhora2 on extract(year from fecha)=extract(year from si_fecha_gmt4) and extract(month from fecha)=extract(month from si_fecha_gmt4) order by fecha