Делаю выборку из таблиц, но результат выводит не верный. хоть группировку использую.
SELECT
/*+ PARALLEL(2) */
s.ID SID
,t.TIME STIME
,s.NAME SNAME
,MAX(t.M8_SUM) M8
,MAX(t.TRAFF_SUM) TRAFF
,MAX(t.PMAC_SUM) PMAC
from
(Select * from (SELECT id,null PMAC_SUM,null TRAFF_SUM, M8_SUM , TIME FROM TOK.N4444
union
SELECT id,null PMAC_SUM,null TRAFF_SUM, M8_SUM , TIME FROM TOK.N5555)
UNION
(SELECT id,null PMAC_SUM, TRAFF_SUM ,null M8_SUM, TIME FROM TOK.H6666
union
SELECT id,null PMAC_SUM, TRAFF_SUM, null M8_SUM , TIME FROM TOK.H7777)
UNION
(SELECT id, PMAC_SUM,null TRAFF_SUM ,null M8_SUM, TIME FROM TOK.E8888
union
SELECT id, PMAC_SUM,null TRAFF_SUM, null M8_SUM , TIME FROM TOK.E9999))t
LEFT JOIN (Select ID,NAME from TOK2.ORIGINAL) s ON s.ID = t.ID where s.ID is not null and
t.TIME = to_timestamp ('2021-01-25' ,'RRRR-MM-DD') and s.ID like '842145'
group by s.ID,t.TIME,s.NAME,t.M8_SUM ,t.TRAFF_SUM,t.PMAC_SUM