Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Please help w/ SQL question

Re: Please help w/ SQL question

From: Sean <dolans_at_my-deja.com>
Date: 2000/05/26
Message-ID: <8gmaek$e2k$1@nnrp1.deja.com>#1/1

Almost. The catch is that the VALUE table might have:  USER_LU USERNAME VALUE

Your query would return all these values, and I only need the ones based on username = 'foobarusername', and still get back the CITY and ADDRESS with nulls as in your example.

Thanks,
Sean

In article <eg3riss9jhe0crtnn8rotvfllapjr48kti_at_4ax.com>,   jonathan_at_gennick.com wrote:
> Is this the behavior that you are after:
>
> SQL> select * from user_lu;
>
> USER_LU
> -------
> name
> address
> city
>
> SQL> select * from user_lu_value;
>
> USER_LU USERNAME VALUE
> ------- -------------- -------------------------
> name foobarusername Sean
>
> SQL> set null ***null***
> SQL> l
> 1 select user_lu.user_lu_id, v.value
> 2 from user_lu, user_lu_value v
> 3* where user_lu.user_lu_id = v.user_lu_id (+)
> SQL> /
>
> USER_LU VALUE
> ------- ------------------------------
> address ***null***
> city ***null***
> name Sean
>
> Jonathan
>
> _____________________________________________________
> jonathan_at_gennick.com
> http://gennick.com
> Brighten the Corner Where You Are
>
> On Thu, 25 May 2000 16:44:37 GMT, Sean <dolans_at_my-deja.com>
> wrote:
>
> >I have two tables: a lookup and a value table. Let me describe them
> >below:
> >
> >USER_LU
> >===============
> >USER_LU_ID (PK)
> >--------------
> >DISPLAY
> >
> >
> >USER_LU_VALUE
> >===============
> >USER_LU_ID (PK)
> >USERNAME (PK)
> >---------------
> >VALUE
> >
> >
> >Some values that would be in the lookup table: {1, NAME} {2,ADDRESS}
> >{3, CITY}
> >Some values in the Value table : {1, 'foobarUsername', 'Sean'}
> >
> >What I am trying to do is get a list of ALL the lookups with a value
> >for a certain username, but throw a NULL if not there as in:
> >{given a username of foobarUsername}
> >NAME Sean
> >ADDRESS NULL
> >CITY NULL
> >
> >ALL I Keep getting is
> >NAME Sean
> >
> >
> >I have tried outer joins but the problem comes in when I specify
> >USERNAME = '{something}' It all goofs up.
> >
> >Any ideas of accomplishing this?
> >Thanks,
> >Sean
> >
> >
> >Sent via Deja.com http://www.deja.com/
> >Before you buy.
>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Fri May 26 2000 - 00:00:00 CDT

Original text of this message

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