mabus Posted October 28, 2008 Share Posted October 28, 2008 Hello, I'm having another mysql query problem, and this involves something like pivoting a query table. Here's my example table.. YearMonth | TotalView | ViewType 2008-01 100 Type1 2008-02 200 Type2 2008-03 300 Type1 Now, what I want to achieve is that instead of having that "ViewType" column, I would want to have colums that are the values from that "ViewType" column. In other words, it will be two additional columns namely "Type1", and "Type2"... here's a sample result of what I would want... YearMonth | Type1| Type2 2008-01 100 10 2008-02 200 200 2008-03 300 300 Something like that. The way I see it, I need to do a pivot on the table rows, but I do not know how to do that yet, and I haven't found a good tutorial for it yet. So, if you have ideas on how I I may achieve this, please send your advices. Thanks in advance Link to comment https://forums.phpfreaks.com/topic/130376-how-to-pivot-rows-into-table-colums/ Share on other sites More sharing options...
Barand Posted October 28, 2008 Share Posted October 28, 2008 This looks very similar to the problem you posted here http://www.phpfreaks.com/forums/index.php/topic,222428.msg1025702.html#msg1025702 Link to comment https://forums.phpfreaks.com/topic/130376-how-to-pivot-rows-into-table-colums/#findComment-676906 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.