请求高人指点!帮忙解决sql语句问题
以下是我做一个数据窗口的后台sql语句,但结果却无限循环地重复显示,在前面添加unique或distinct确像死锁一样,想不明白。请求高人指点!先谢过了
SELECT ab07.AAB001,
AB07.AAB019,
AB07.AAB020,
AB07.AAB137,
to_number(0000) as year,
Ab01_t.AAB004,a.jan,b.feb,c.mar,d.apr,e.may,f.jun,g.jul,
h.aug,i.sep,j.oct,k.nov,l.dec
FROM (select aab001,aae002,aab137 jan from ab07 where substr(aae002,5,2)='01') a,
(select aab001,aae002,aab137 feb from ab07 where substr(aae002,5,2)='02') b,
(select aab001,aae002,aab137 mar from ab07 where substr(aae002,5,2)='03')c,
(select aab001,aae002,aab137 apr from ab07 where substr(aae002,5,2)='04') d,
(select aab001,aae002,aab137 may from ab07 where substr(aae002,5,2)='05') e,
(select aab001,aae002,aab137 jun from ab07 where substr(aae002,5,2)='06') f,
(select aab001,aae002,aab137 jul from ab07 where substr(aae002,5,2)='07') g,
(select aab001,aae002,aab137 aug from ab07 where substr(aae002,5,2)='08') h,
(select aab001,aae002,aab137 sep from ab07 where substr(aae002,5,2)='09') i,
(select aab001,aae002,aab137 oct from ab07 where substr(aae002,5,2)='10') j,
(select aab001,aae002,aab137 nov from ab07 where substr(aae002,5,2)='11') k,
(select aab001,aae002,aab137 dec from ab07 where substr(aae002,5,2)='12') l,
ab07,ab01_t
WHERE
ab01_t.aab001=ab07.aab001 and ab07.aae140=3 and
ab07.aab001=a.aab001 and substr(ab07.aae002,1,4)=substr(a.aae002,1,4) and
a.aab001=b.aab001 and substr(a.aae002,1,4)=substr(b.aae002,1,4) and
b.aab001=c.aab001 and substr(b.aae002,1,4)=substr(c.aae002,1,4) and
c.aab001=d.aab001 and substr(c.aae002,1,4)=substr(d.aae002,1,4)and
d.aab001=e.aab001 and substr(d.aae002,1,4)=substr(e.aae002,1,4) and
e.aab001=f.aab001 and substr(e.aae002,1,4)=substr(f.aae002,1,4) and
f.aab001=g.aab001 and substr(f.aae002,1,4)=substr(g.aae002,1,4)and
g.aab001=h.aab001 and substr(g.aae002,1,4)=substr(h.aae002,1,4) and
h.aab001=i.aab001 and substr(h.aae002,1,4)=substr(i.aae002,1,4) and
i.aab001=j.aab001 and substr(i.aae002,1,4)=substr(j.aae002,1,4) and
j.aab001=k.aab001 and substr(j.aae002,1,4)=substr(k.aae002,1,4)and
k.aab001=l.aab001 and substr(k.aae002,1,4)=substr(l.aae002,1,4)