Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SubQuery Question
These are all great suggestions guys and I feel that I'm getting
closer to solving my problem. I took your suggestions Vikas and made
them into 1 select statement that looks like this:
select papp.WORKPLAN_NR,sum(papp.UNIT_NR)
from w100.papp,w100.papk
where papp.WORKPLAN_NR = papk.WORKPLAN_NR
group by papp.WORKPLAN_NR
having sum(decode(UNIT_NR,3400,1,3500,1,3430,1)) != 3
With this select statement I get all the records I don't want (this is good) but I get the problem when I try to combine the select statement with another. I'd like to do something like this:
select papp.WORKPLAN_NR,sum(papp.UNIT_NR)
from w100.papp,w100.papk
where papp.WORKPLAN_NR = papk.WORKPLAN_NR
group by papp.WORKPLAN_NR
having sum(decode(UNIT_NR,3400,1,3500,1,3430,1)) = 3
not in
(select papp.WORKPLAN_NR,sum(papp.UNIT_NR)
from w100.papp,w100.papk
where papp.WORKPLAN_NR = papk.WORKPLAN_NR
group by papp.WORKPLAN_NR
having sum(decode(UNIT_NR,3400,1,3500,1,3430,1)) != 3 )
But this doesn't work. Does anyone know how I can join the 2 select statements? Received on Mon Feb 21 2005 - 02:38:27 CST