我有这样的查询
select
to_char(WAKTU,'DD-MM-RRRR HH24:MI') waktu, a.KODE_ALAT,
min(case when aa.KODE_STATISTIK = 'HOIST' then a.NILAI else null end) HOIST,
min(case when aa.KODE_STATISTIK = 'TROLLEY' then a.NILAI else null end) TROLLEY,
min(case when aa.KODE_STATISTIK = 'GANTRY' then a.NILAI else null end) GANTRY,
min(case when aa.KODE_STATISTIK = 'ENGINE' then a.NILAI else null end) ENGINE,
min(case when aa.KODE_STATISTIK = 'COUNTER' then a.NILAI else null end) COUNTER
from
TRECORD_STATISTIK_ALAT a
left outer join
TALAT_STAT aa on aa.KODE_STATISTIK = a.KODE_STATISTIK
join
valat v on v.kode_alat=a.kode_alat
where
v.jenis_alat ='RTG'
and (waktu between to_date('24-11-2018','DD-MM-RRRR hh24:mi') and to_date('04-12-2018','DD-MM-RRRR hh24:mi'))
group by
a.waktu, a.KODE_ALAT
order by
a.waktu desc;
Data of KODE_STATISTIK
是动态的,如何选择kode_statistik
中所有talat_stat
,在我的代码中,我必须声明所有kode_statistik
。