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: Quick nested SQL question

Re: Quick nested SQL question

From: Rich <richmun_at_yahoo.com>
Date: Fri, 15 Nov 2002 15:43:19 GMT
Message-ID: <rC8B9.8665$P31.2871@rwcrnsc53>


P.S. Forgot to add that it doesn't work. Thanks again. "Rich" <richmun_at_yahoo.com> wrote in message news:ZO7B9.9383$%m4.2326_at_rwcrnsc52.ops.asp.att.net...
> Howdy. Ok it's an ugly SQL statement. But I wonder if it should work?
>
> I have a user table t_user, and a group of friends (of the users) table
> t_group.
>
> Looks like this
>
> T_USER
>
> ID FIRSTNAME ...............................
> ----------------------------------------------------------
> 409 RICH
> 500 JIM
> 600 BOB
> 700 TOM
>
> T_GROUP
>
> ID FRIEND_ID ...............................
> ----------------------------------------------------------
> 409 500
> 409 600
>
> I want to be able to select records in t_user for RICH but exclude RICH's
> FREND_ID's (He's already added them so I don't want to give him a choice
on
> the GUI.
>
> Or is there a better way to execute this?
>
> Here is my first shot at it.
>
> select t_user.id , t_user.firstname, t_user.lastname from t_user,
t_group -
> where (t_group.friend_id) in -
> ( -
> select t_group.friend_id from t_group where (t_group.friend_id) NOT
> IN -
> ( -
> select t_group.friend_id from t_group where t_group.id = '406' -
> ) -
> );
>
> Any help would be appreciated. Thanks
>
> rich
>
>
>
>
Received on Fri Nov 15 2002 - 09:43:19 CST

Original text of this message

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