Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Can I do this with SQL
Hi Stan,
In an ideal world you should split up, as this is IMHO against all rules of
proper db design.
However, you should be able to do it:
select p.id, p.name, c1.desc, c2.desc
from personel p, codes c1, codes c2
where c1.code = p.position
and c2.code = p.building
Hth,
Sybrand Bakker, Oracle DBA
DelphiDev wrote:
> Consider the two tables:
>
> PERSONEL
> ID POSITION BUILDING NAME
> 003 VP 01 Smith
> 004 PRES 02 Jones
> 005 VP 02 Gates
> 006 PROF 01 Ford
> 007 PRES 01 Kenneth
>
> CODES
> CODEQUAL CODE DESC
> BUILDING 01 Building I
> BUILDING 02 Building II
> POSITION VP Vice President
> POSITION PRES President
> POSITION PROF Professor
>
> What would be the applicable SQL context if I wanted a list of the name
> from PERSONEL, and the descriptions are the building and position?
> I hope I don't have to break up my "CODES" table into a bunch of smaller
> ones. The reason it was done this was because it was ported from a file
> based system and done to keep the number of files to a minimum.
>
> Thanks, Stan.
Received on Mon Mar 01 1999 - 15:52:45 CST