mysql - SQL transpose and groupby -
this question has answer here:
- mysql pivot table 8 answers
how transpose grouping column
time tag value 10 abc 67 11 abc 68 12 abc 65 10 cdf 23 11 cdf 24 12 cdf 25 time abc cdf 10 67 23 11 68 24 12 65 25
this simple pivot query this:
select time sum(if(tag='abc',value,null)) abc, sum(if(tag='cdf',value,null)) cdf yourtable group time i hope helpful :)
Comments
Post a Comment