Re: Dumb Oracle Question

From: Mtek <mtek_at_mtekusa.com>
Date: Wed, 4 Jun 2008 16:08:53 -0700 (PDT)
Message-ID: <a41d6f3c-62b9-4a0c-ba46-23e710f4bdd7@w7g2000hsa.googlegroups.com>


On Jun 4, 6:00 pm, DA Morgan <damor..._at_psoug.org> wrote:
> Mtek wrote:
> > Hi,
>
> > Aren't these statements supposed to be equal??
>
> > select cust_no from customer where z_rank_d = 1
> > minus
> > select cust_no from customer_rank1;
>
> > select cust_no from customer where z_rank_d = 1
> >   and not exists
> > (select cust_no from customer_rank1);
>
> > What am I missing?  The first returns 27 rows, the second,
> > nothing.......
>
> > John
>
> What you are missing is that your subquery is uncorrelated.
>
> The syntax you are looking for is a derivative of this:
> SELECT srvr_id
> FROM servers s
> WHERE EXISTS (
>    SELECT srvr_id
>    FROM serv_inst i
>    WHERE s.srvr_id = i.srvr_id);
>
> Note the second WHERE clause.
> --
> Daniel A. Morgan
> Oracle Ace Director & Instructor
> University of Washington
> damor..._at_x.washington.edu (replace x with u to respond)
> Puget Sound Oracle Users Groupwww.psoug.org- Hide quoted text -
>
> - Show quoted text -

Thank you!!! Received on Wed Jun 04 2008 - 18:08:53 CDT

Original text of this message