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 -> How can I do this problem

How can I do this problem

From: samc <samc_at_ctxopto.com.tw>
Date: 15 Dec 1999 07:39:49 GMT
Message-ID: <385745C3.790D0A2F@ctxopto.com.tw>


I have two table

a_table :

PN SUB org OHQTY
--------- ------------ ---------- ---------

55                   M1            106        60
55                   M1            106        70
55                   M1            106        30
55                   M1            108        35
56                   M1            106        40
56                   M2            106        30
57                   M1            106        20

b_table is:

PN SUB org TRQTY
--------- ------------ ---------- ---------

55                   M1            106        20
55                   M1            106        20
55                   M1            106      100
55                   M1            106      -10
55                   M1            108        35
56                   M2            106        40
56                   M2            106        50
56                   M2            106       -50
57                   M3            106        20


I want to find a_table.sum(OHQTY) != b_table.sum(TRQTY)

This is my SQL statement .

  select a.pn, a.sub,a.org,
  sum(nvl(a.ohqty,0)),sum(nvl(b.trqty,0))   from a_table a,

          b_table b
  where a.pn = b.pn
  and a.sub = b.sub
  and a.org = b.org
  group by a.pn, a.sub,a.org
  having sum(nvl(ohqty,0)) != sum(nvl(trqty,0))   order by pn,sub Received on Wed Dec 15 1999 - 01:39:49 CST

Original text of this message

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