mysql - SQL transpose and groupby -


this question has answer here:

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

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -