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: Merge 2 select statements ?

Re: Merge 2 select statements ?

From: Hans Forbrich <forbrich_at_yahoo.net>
Date: Thu, 27 Nov 2003 23:34:56 GMT
Message-ID: <3FC68A05.FABD1F60@yahoo.net>


mhk wrote:
>
> Hi,
>
> can anyone know how to merge two select statements into one
>
> Example :
>
> "select * from emp where location_id = 1"
> other is
> "select * from emp where location_id = 2"
>
> Now how can i merge these two with a single select statement. its a
> simple example but i am using a tough one in reality.
>

Basic SQL!

Select *
  from emp
 where location_id IN (1, 2, 3 ...)

OR

Select *
  from emp
 where location_id = 1

    OR location_id = 2;

Please get an Intro to SQL book or course (or stay awake & take notes during the course, if you are a student). There may Be Many alternate solutions and a blanket answer in this newsgroup may not be correct in some situations. Received on Thu Nov 27 2003 - 17:34:56 CST

Original text of this message

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