Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mulitple join - how to hide when there is no result?

Status
Not open for further replies.

sebsol

Technical User
Aug 25, 2003
8
FR
Hi,

I have a request that displays result from different tables.
Basically it goes like this

SELECT view.code, NVL(a.sum_a,0), NVL(b.sum_b,0), NVL(c.sum_c,0) FROM
view, a, b, c
WHERE view.code=a.code(+)
AND view.code=b.code(+)
AND view.code=c.code(+)
...

this request is off course just a model.
i calculate the sum of 3 different things in a, b and c.

Basically if there is no result in sum_a, sum_b AND sum_c, i would like the line to be discarded (or hidden).
Anybody has any idea for this ?

Thanks a lot.

Seb
 
[tt]SELECT code,
NVL(sum_a,0),
NVL(sum_b,0),
NVL(sum_c,0)
FROM (
SELECT view.code, a.sum_a, b.sum_b, c.sum_c
FROM view, a, b, c
WHERE view.code=a.code(+)
AND view.code=b.code(+)
AND view.code=c.code(+) )
WHERE sum_a IS NOT NULL
OR sum_b IS NOT NULL
OR sum_c IS NOT NULL;[/tt]

 
Thanks a lot... and doh, why didn't I think about that?


Cheers
Seb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top