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: compound SQL queries and DISTINCT problem

Re: compound SQL queries and DISTINCT problem

From: Knut Talman <knut.talman_at_mytoys.de>
Date: Wed, 30 May 2001 17:35:42 +0200
Message-ID: <3B15134E.7B47BA7E@mytoys.de>

> If you use the minus operator in the following way:
>
> select x from table1
> minus
> select x from table2
>
> you will get the result
>
> x
> ---
> B
> D
>
> despite of the fact, that table1 contains the row B two times. I'd like to
> get the result:
>
> x
> ---
> B
> B
> D
>
> Any ideas ? Would be great.

The only idea I have is:

SELECT x FROM table1 WHERE x=(
SELECT x FROM table1
MINUS
SELECT x FROM table2);

Regards,

Knut

-- 
Knut Talman                                     Fon +49 30 72 62 01 411
dba_at_myToys.de                                   Fax +49 30 72 62 01 222
          The degree of normality in a database is inversely             
                    proportional to that of its DBA
Received on Wed May 30 2001 - 10:35:42 CDT

Original text of this message

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