Historical data - Add unit and timestep to timeseries selection
Add unit and timestep in the sql label output.
The example makes the query too slow so do after issue #20 is done.
select
aa.value,
CONCAT(aa.networkname, ', ', aa.name,', ', aa.pollutant, ', ', oo.unit, ', ', oo.timestep) as label,
to_char(oo.fromtime, 'YYYY-MM-DD"T"HH24:MI:SS') as fromtime,
to_char(oo.totime, 'YYYY-MM-DD"T"HH24:MI:SS') as totime,unit, timestep
from
(
select sp.id as sp, oc.id as value, s.name, po.notation pollutant, n.name networkname
from stations s,
sampling_points sp,
observing_capabilities oc,
eea_pollutants po,
networks n
where 1=1
and s.id = sp.station_id
and n.id = s.network_id
and sp.id = oc.sampling_point_id
and reverse(split_part(reverse(oc.pollutant), '/', 1)) = po.id
group by s.name, sp.id, oc.pollutant, n.name, oc.id, po.notation
) aa
inner join
(
select o.sampling_point_id, MIN (o.from_time) as fromtime, MAX(o.from_time) as totime, reverse(split_part(reverse(o.concentration), '/', 1)) unit, reverse(split_part(reverse(o.timestep), '/', 1)) timestep
from observations o
group by o.sampling_point_id, reverse(split_part(reverse(o.concentration), '/', 1)), reverse(split_part(reverse(o.timestep), '/', 1))
) oo
on aa.sp = oo.sampling_point_id
order by label