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: SQL query for finding values that are not contained in a table

Re: SQL query for finding values that are not contained in a table

From: Jens <Jens_Loebling_at_yahoo.de>
Date: 19 Oct 2005 01:32:09 -0700
Message-ID: <1129710729.318191.194930@g14g2000cwa.googlegroups.com>


Hallo dimitris,

pleas try this

(SELECT 'a1' FROM dual UNION
 SELECT 'a2' FROM dual UNION
 SELECT 'a3' FROM dual UNION

 ...
 SELECT 'an' FROM dual)
MINUS
SELECT col1 FROM tab1;

best regards
Jens Löbling

dimitris_at_cs.umb.edu wrote:
> Hi,
>
> I was wondering if there is a simple way to write a sql query
> and do the following:
>
> Given a list of values eg ('a1', 'a2', 'a3', ...) ,which could
> be included in the query, we would like to look in some
> table column (eg col1 of tab1) and select the values that are
> not included in the column but they are included in our list.
>
> One way would be to create an additional table, store the values we
> would like to check and then write a query to access both tables,
> but I was wondering if we could do this in a simpler way preferably
> with a single sql statement.
>
> Thanks.
>
> D.
Received on Wed Oct 19 2005 - 03:32:09 CDT

Original text of this message

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