Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: SubQuery Question

Re: SubQuery Question

From: Paul Izzo <paul.izzo_at_mosca-ag.com>
Date: 21 Feb 2005 00:38:27 -0800
Message-ID: <1108975107.251801.259720@c13g2000cwb.googlegroups.com>


  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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US