1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
select LEAST(iddate,jddate,kddate), max(ival) "1", max(jval) "2", max(kval) "3"
from (SELECT to_date(ddate)as iddate, to_number(id)as iid, to_number(value)as ival FROM mesure WHERE id = '1'
UNION
SELECT DISTINCT to_date(ddate), to_number(2), to_number(NULL) from mesure
) i,
(SELECT to_date(ddate)as jddate, to_number(id)as jid, to_number(value)as jval FROM mesure WHERE id = '2'
UNION
SELECT DISTINCT to_date(ddate), to_number(2), to_number(NULL) from mesure
) j,
(SELECT to_date(ddate)as kddate, to_number(id)as kid, to_number(value)as kval FROM mesure WHERE id = '3'
UNION
SELECT DISTINCT to_date(ddate), to_number(2), to_number(NULL) from mesure
) k
where
iddate = jddate and
iddate = kddate
group by iddate,jddate,kddate; |
Partager