I have these query:
select b.type,b.name,a.name_b,a.start_time
from runinfo a left JOIN definition b
on a.sched_table=b.parent_table
and a.name_b=b.name
where sched_table not like 'PLAN'
and to_char(start_time,'YYYYMMDD') = to_char(current_date-1,'YYYYMMDD')
order by start_time desc;
Tables are:
DEFINITION
----------
TYPE: COMMAND
NAME: DAVE
.........
RUNINFO
-------
START_TIME: 2019/08/15 23:59
NAME_B: DAVE
.........
START_TIME: 2019/08/15 23:58
NAME_B: DAVE
........
I get duplicate rows and I can't understand:
TYPE NAME START_TIME NAME_B
COMMAND DAVE 2019/08/15 23:59 DAVE
COMMAND DAVE 2019/08/15 23:59 DAVE
COMMAND DAVE 2019/08/15 23:58 DAVE
COMMAND DAVE 2019/08/15 23:58 DAVE
Why I get two rows of every record?
thanks and sorry for my English!
select distinctto handle the symptom, but your underlying tables would seem to have duplicates.