mysql - Dynamically added column to sql results -
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
Post a Comment