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: select query - how can i do this

Re: select query - how can i do this

From: <bankov6315_at_my-deja.com>
Date: 2000/05/06
Message-ID: <8f1bu5$q4v$1@nnrp1.deja.com>#1/1

Here is the query you need:

select cl.client_id "Client", cih.city "Home", ciw.city "Work" from clients cl, cities cih, cities ciw
where cl.homezip=cih.zip AND cl.workzip=ciw.zip /

Best regards,

Sergei Shepelev,
Oracle junior DBA
Resume at http://data4translators.com/resume.doc
>>>>>>>

In article <8evrm6$9ao$1_at_nnrp1.deja.com>,   madsere_at_my-deja.com wrote:
> Oh Gurus:
>
> I got a problem with normalizing a database.
> A very simple example - assume i have two tables: clients and cities.
>
> clients:
> client_id
> homezip
> workzip
>
> cities:
> zip
> city
>
> select * from clients:
> 1,1000,1001
> 2,2001,2002
>
> select * from cities
> 1000 city-a
> 1001 city-b
> 2001 city-c
> 2002 city-d
>
> Now, I'd like to make a query that produces a line like
>
> client home work
> 1 city-a city-b
> 2 city-c city-d
>
> With just one city it would be easy but with two ...
>
> any suggestions?
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>

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

Original text of this message

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