Re: Outer joins; need some assistance
Date: Thu, 13 Oct 1994 13:37:24
Message-ID: <bodkis.3.0138BCB2_at_fionn.cuug.ab.ca>
In article <374vgu$spj_at_newstand.syr.edu> eastephe_at_rodan.syr.edu (Eric A. Stephens) writes:
>From: eastephe_at_rodan.syr.edu (Eric A. Stephens)
>Subject: Outer joins; need some assistance
>Date: 8 Oct 1994 02:18:06 GMT
>We have a set of two Oracle tables which together make up a group of
>transactions for a system. We are attempted to perform the following
>SQL
>but realize that only one table (either one) may have data in it
>fitting the where
>clause while the other (again, either one) may not have any data. I've
>seen
>the Oracle manual where it discusses outer joins, but the example
>employs
>a one-to-many type scheme. This scenario doesn't follow the example in
>the
>manual. Any clues how to code the SQL for this type of situation?
> SELECT sum(TOPS."VACCT_TRANS"."CR_AMT") +
> sum(TOPS."VREMIT_TRANS"."LDGR_CR_AMT") +
> sum(TOPS."VREMIT_TRANS"."PYMNT_AMT"),
> sum(TOPS."VACCT_TRANS"."DB_AMT") +
>sum(TOPS."VREMIT_TRANS"."LDGR_DB_AMT")
> FROM "TOPS"."VACCT_TRANS",
> "TOPS"."VREMIT_TRANS"
> WHERE ( "TOPS"."VACCT_TRANS"."BATCH_NO" = :as_batch_no ) AND
> ( "TOPS"."VACCT_TRANS"."STUB_DTE" = :adt_stb_dte ) AND
> ( "TOPS"."VACCT_TRANS"."BATCH_SRC_CD" = :as_batch_src_cd )
>AND
> ( "TOPS"."VREMIT_TRANS"."BATCH_NO" = :as_batch_no ) AND
> ( "TOPS"."VREMIT_TRANS"."STUB_DTE" = :adt_stb_dte ) AND
> ( "TOPS"."VREMIT_TRANS"."BATCH_SRC_CD" = :as_batch_src_cd )
I am not sure if I follow everything, but you may want to try a union. Received on Thu Oct 13 1994 - 13:37:24 CET