That'd be a pivot query, and they're not supported in mysql. the workarounds get very ugly, very fast, and cannot handle arbitrary "n-wise" pivots either. do the transform in client-side code.
– Marc BJul 13 '16 at 16:34
Possible duplicate of [MySQL pivot table](http://stackoverflow.com/questions/7674786/mysql-pivot-table)
– Rose KunkelJul 13 '16 at 17:50
"The transform" to which @MarcB refers could be attacked more readily if you provided the merest example of what you're trying to accomplish, since an English description is obviously evading you.
– Bruce David WilnerJul 13 '16 at 17:55