MySQL Forums
Forum List  »  Newbie

Re: Transform or Pivot(?) or Crosstab(?) table in mySQL. One data table.
Posted by: Bob Field
Date: April 08, 2006 09:46AM

SELECT year,
sum(if(season='Spring', hits, 0)) AS Spring,
sum(if(seasons='Summer', hits, 0)) AS Summer,
sum(if(season='Autumn', hits, 0)) AS Autumn
FROM yourTable
GROUP BY year;

Options: ReplyQuote


Subject
Written By
Posted
Re: Transform or Pivot(?) or Crosstab(?) table in mySQL. One data table.
April 08, 2006 09:46AM


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.