CrystalReport
Programmer
I have 2 tables 1 containing chain & another containing Collection. In short in Chain Table i have one field called Code and another called introcode, & in another Table Called Collection has got 2 fields that containing code & collection, now the thing is that the collection has to go his code & his introcode till in the loop having introcode=code. i.e.
Chain Collection
====== ===========
Code IntroCode Code Collection
101 0 304 1,000
201 101 304 1,500
202 101 303 500
301 201 303 2,000
302 201 302 1,000
303 202 302 1,000
304 202 301 500
201 100
202 500
Now the thing is that i want a sql i.e. if i pass a parameter code=101 then the ouput should be like this.
chain Collection
====== ==========
-101 8,100 i.e. (0[self] + 2,600 + 5,500)
+201 2,600 i.e. (100[self] + 500 + 2,000)
+301 500
+302 2,000
+202 5,500 i.e. (500[self] + 2,500 + 2,500)
+303 2,500
+304 2,500
Note : Please Check this query, it gives me 50% of the answer by dosen't add to the introcode. or eiter it dosen't gives the above output
SELECT a1.code,a2.code,sum(c2.collection),a3.code,sum(c1.collection)
FROM chain a1
FULL OUTER JOIN chain a2
on a1.code=a2.introcode
FULL OUTER JOIN collection c2
on c2.code=a2.code
FULL OUTER JOIN chain a3
on a2.code=a3.introcode
FULL OUTER JOIN certificate c1
on c1.code=a3.code
WHERE a1.code='101'
group by a3.code,a2.code,a1.code
Please give me the solution i have got bugged with this i have heared that drill down can solve my problem, pl. forward me the solution at
pankaj_cash@hotmail.com
from
pankaj.
[sig][/sig]
Chain Collection
====== ===========
Code IntroCode Code Collection
101 0 304 1,000
201 101 304 1,500
202 101 303 500
301 201 303 2,000
302 201 302 1,000
303 202 302 1,000
304 202 301 500
201 100
202 500
Now the thing is that i want a sql i.e. if i pass a parameter code=101 then the ouput should be like this.
chain Collection
====== ==========
-101 8,100 i.e. (0[self] + 2,600 + 5,500)
+201 2,600 i.e. (100[self] + 500 + 2,000)
+301 500
+302 2,000
+202 5,500 i.e. (500[self] + 2,500 + 2,500)
+303 2,500
+304 2,500
Note : Please Check this query, it gives me 50% of the answer by dosen't add to the introcode. or eiter it dosen't gives the above output
SELECT a1.code,a2.code,sum(c2.collection),a3.code,sum(c1.collection)
FROM chain a1
FULL OUTER JOIN chain a2
on a1.code=a2.introcode
FULL OUTER JOIN collection c2
on c2.code=a2.code
FULL OUTER JOIN chain a3
on a2.code=a3.introcode
FULL OUTER JOIN certificate c1
on c1.code=a3.code
WHERE a1.code='101'
group by a3.code,a2.code,a1.code
Please give me the solution i have got bugged with this i have heared that drill down can solve my problem, pl. forward me the solution at
pankaj_cash@hotmail.com
from
pankaj.
[sig][/sig]