unpivot in mysql

Posted on 2017-06-18
Last Modified: 2017-06-22
I have seen some of the examples we have for pivot and unpivot in mysql,where the rows and columns are changes accordingly, but i have a table like below


Month    Current            30 Days       30 - 60 Days
Apr-13   1375159316       34511076         6423821
May-13   71398540         5674629          4775687
Jun-13   1314130060       27364660         9328588

and want it to create a new table like below


Month            Apr-13               May-13              Jun-13
Current         1375159316      71398540     1314130060
30 Days         34511076        5674629          27364660
30 - 60 Days     6423821       4775687         9328588

How can i achieve the above.
Question by:baishali deb
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
LVL 78

Expert Comment

See the discussion at https://forums.mysql.com/read.php?10,379790.

another option is to handle this in the display/rendering.

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Join & Write a Comment

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question