hi ,
What I am doing wrong? In my script I have to subqueries first return rownum from 65 to 100 i want to return records with Lmax from 65 to 100 even they don't exist in secod subquery
rmtid Lmax ne
1 65 0
1 66 0
1 67 5
2 65 20
2 66 15
...
What I am doing wrong? In my script I have to subqueries first return rownum from 65 to 100 i want to return records with Lmax from 65 to 100 even they don't exist in secod subquery
rmtid Lmax ne
1 65 0
1 66 0
1 67 5
2 65 20
2 66 15
...
Code:
select rmtid,a.Lmax,b.Lmax,ne
from
(select Lmax
from (select rownum Lmax from all_objects
where rownum <= 100)
where Lmax >=65)a left outer join
(select rmtid,(round(maxlevel)) Lmax,count(round(maxlevel))ne from events
where TO_NUMBER(TO_CHAR(startdate,'mm'))='07' AND TO_NUMBER(TO_CHAR(startdate,'yyyy'))='2005'
group by rmtid,round(maxlevel))b
on a.Lmax = b.Lmax
order by b.rmtid,a.Lmax