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: HELP !!! SQL GURUS !!!! How do I do this ???

Re: HELP !!! SQL GURUS !!!! How do I do this ???

From: Peter Stalhammar <peter.stalhammar_at_senet.abb.se>
Date: 1997/04/02
Message-ID: <334258AF.4ED0@senet.abb.se>#1/1

Grace Wallen wrote:

  If your 'known' values are in a table as well, you can try using   MINUS,
  as in this example:

  select colName from known_values_table   MINUS
  select colName from other_table

  This will give you the values in known_values_table that are not in   other_table.

  Jens U. Veigel wrote:
>
> Hey Pro's
>
> Got a problem.
>
> I'm trying to slelect a column which has numbers in it lets say 1
> through 5, and compare it to a list of known values.
> Lets say 1 through10.
> I would like it to come back with all the matching numbers that
 are
> not in the column such as 6,7,8,9,10.
>
> I was trying somthing like this:
>
> select column
> from table
> where column is not in
>
> (select column from
> table
> where column is in ('1','2','3','4','5','6','7','8','9',10')
>
> then it returns 1,2,3,4,5
>
> what I need it to return is 6.7,8,9,10
> (the exact opposite)
>
> It seems so simple, what am I doing wrong ??
> Thanks for reading it !
>
> Jens
>
> jens_at_deutschware.com
>

  --
  Regards,

  +--------------------------------------------------------------+
  |                                                              |
  | Grace Wallen         Job:    DB Systems Analyst/Programmer   |
  | The Boeing Company   Tel:    206-234-1802                    |
  | DCAC/MRM             Fax:    206-234-2820                    |
  | Process Management   E-mail: Grace.Wallen_at_Boeing.com         |
  | P.O. Box 3707 6X-JT    or    gwallen_at_dcaca002.ca.boeing.com  |
  | Seattle, WA 98124                                            |
  | U.S.A.                                                       |
  +--------------------------------------------------------------+

 Or You can do like this

Select Col_A
from TableA
where not exists (select Col_B from TableB where Col_B = Col_A)

//Peter Stalhammar Received on Wed Apr 02 1997 - 00:00:00 CST

Original text of this message

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