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: SQL sentence

Re: SQL sentence

From: Rene Nyffenegger <rene.nyffenegger_at_gmx.ch>
Date: Thu, 21 Jul 2005 19:32:13 +0000 (UTC)
Message-ID: <dbot7t$ihv$2@klatschtante.init7.net>


On 2005-07-21, MĒ Carmen Lozano <noriepa_at_teleline.es> wrote:
> I have a table in oracle with information similar to this:
>
> city code
> A XX
> B SS
> A ZZ
> C YY
> D XX
> B SS
> B ZZ
>
> I need to preferably make by means of a sentence SQL or by
> means of a process a table with the following structure:
>
> city SS XX YY ZZ
> A 0 1 0 1
> B 2 0 0 1
> C 0 0 1 0
> D 0 1 0 0
>
> Can somebody help me?
>
> A greeting and thank you very much

What you want is called a pivot query.
You can find an example of such a pivot
query on my homepage at:
http://www.adp-gmbh.ch/ora/sql/examples/pivot.html

hth
Rene

-- 
  Rene Nyffenegger
  http://www.adp-gmbh.ch/
Received on Thu Jul 21 2005 - 14:32:13 CDT

Original text of this message

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