Hi,

Some Body wrote:
Hi all,
 I have a situation where the data in a table has to
be transposed.
 I have a table having columns
id, a_id, a1, a2, a3, a4, ..., an

In the query I need a result similar to
    a_id  a_id   a_id
    2001  2002   2003
a1  1      2      1
a2  1      5      6
a3  2      7      2
a4  3      9      5
... ..     ..     ..
an  n      1      1

How does a SQL statement of stored proc/function look
like to achieve this?

Giuseppe Maxia wrote a great article on this some time ago. The technique is called cross-tabulation or pivot tables. Here is a link:
http://www.onlamp.com/pub/a/onlamp/2003/12/04/crosstabs.html

Baron

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to