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

Home -> Community -> Usenet -> c.d.o.server -> Re: Multiple Conditions for an Outer Join?

Re: Multiple Conditions for an Outer Join?

From: Galen Boyer <galenboyer_at_hotpop.com>
Date: 2 May 2002 23:42:07 -0500
Message-ID: <ubsbx4qsn.fsf@rcn.com>


On 2 May 2002, seth_at_brivo.net wrote:
> Hello,
>
> I've been searching around for this answer (or work around) but not
> finding much because I'm not sure how to phrase the question. I'm
> hoping someone can point me to some tips or hints.
>
> I'm currently running Oracle 8.1.7 on Solaris. I want to write a
> query like this:
>
> SELECT <stuff> FROM table1, table2
> WHERE table1.id = table2.t1_id (+)
> AND (table2.x (+) = 12345 OR table2.x (+) = 12346)

SQL>select * from t1;

      FLD1


	 1
	 2
	 5

SQL>select * from t2 order by fld1;

      FLD1 FLD2
---------- ----------

	 1 AA
	 1 BB
	 2 AA
	 2 CC
	 3 AA
	 4 BB

SQL>select *
     from t1,(select * from t2 where t2.fld2 = 'AA' or t2.fld2 = 'BB') t3
     where t1.fld1 = t3.fld1 (+)
     ;

      FLD1	 FLD1 FLD2
---------- ---------- ----------
	 1	    1 AA
	 1	    1 BB
	 2	    2 AA
	 5


-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.
Received on Thu May 02 2002 - 23:42:07 CDT

Original text of this message

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