Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: SQL question
have you tried using the DECODE fuction in your select statement? I can't recall the exact syntax offhand but I think it is something like:
select decode(field1,NULL,'NULL',field1) from table1
where USERNAME = '{something}';
HTH,
Roy
In article <8hm1pj$aoi$1_at_nnrp1.deja.com>,
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 USER_LU table:
> {1, NAME}
> {2, ADDRESS}
> {3, CITY}
>
> Some values in the USER_LU_VALUE table :
> {1, 'foobarUsername', 'Sean'}
> {1, 'usernameTwo', 'Mike'}
>
> 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:
> {ex: given a username of foobarUsername:}
> NAME Sean
> ADDRESS NULL
> CITY NULL
>
> ALL I Keep getting is
> NAME Sean
>
> I have tried outer joins (+) and get :
> NAME Sean
> NAME Mike
> ADDRESS null
> CITY null
>
> 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 Wed Jun 07 2000 - 00:00:00 CDT
![]() |
![]() |