Re: matrix transpose in SQL?

From: Vadim Tropashko <nospam_at_newsranger.com>
Date: Fri, 27 Apr 2001 18:38:57 GMT
Message-ID: <51jG6.1106$SZ5.92310_at_www.newsranger.com>


In article <9cc87u$i3a$1_at_stlnews.stl.ibm.com>, Aakash Bordia says...
>
>The reason for my representation of numbers as I had in my original mail, is
>that it is not uncommon amongst data warehousing customers to have data laid
>out in such format which they either want to pivot or transpose. My example
>was probably the simplest of all that I could have provided.A practical case
>might be a matrix of monthXproduct, with sales being the numbers, and the
>end user wants it the other way.
>Preety normal requirement. Also they would have an order on such a table. I
>agree that RDBMS do not provide an order inherently.
>Thanks for the reference to Celkos guide. I would surely look at the other
>kind of example that you provide.
>My previous posted solution numbers all the elements of the matrix and goes
>from there.
>

Well, but then you also might want to transform

> I J VALUE
> 1 1 1
> 1 2 2
> 1 3 3
> 2 1 4
> 2 2 5
> 2 3 6
> 3 1 7
> 3 2 8
> 3 3 9

into

| j1 | j2 | j3


i1 |  1 |  2 |  3
i2 |  4 |  5 |  6
i3 |  7 |  8 |  9

or not? Received on Fri Apr 27 2001 - 20:38:57 CEST

Original text of this message