mysql - Dynamically added column to sql results -


enter image description here

i'd have sql results containing dynamically added fields. picture attached explains aim at.

as far i've made below, yet doesn't work.

select s.num, s.name ( select g.grade g.subject grades g g.student = s.id ) students s; 

note want have column name corresponding value of column subject. have no idea how it.

you need construct dynamic sql prepared statements.

http://blog.sqlauthority.com/2014/06/20/mysql-dynamic-sql-with-execute-and-prepare-statements/

the columns come "as history" ... "as math"

as far nulls common outer join action


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -