MySQL Forums
Forum List  »  General

Re: Spinning rows into columns, in a view. Is it possible?
Posted by: Peter Brawley
Date: March 11, 2006 10:19PM

You want to cross-tabulate value for location & month. Why not just ...

CREATE VIEW crosstab AS
SELECT mon,
MAX( IF(location=1,value,'') ) AS '#1',
MAX( IF(location-2,value,'') ) AS '#2',
MAX( IF(location=3,value,'') ) AS '#3',
...
FROM tbl
GROUP BY mon

PB

Options: ReplyQuote


Subject
Written By
Posted
Re: Spinning rows into columns, in a view. Is it possible?
March 11, 2006 10:19PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.