c# - Turning a dynamic MySQL pivot query into a view -
for background information: i'm planning reporting in c# entity framework , need create view each report (at least believe do).
i have found solutions on how receive information need on various pages. google of help, too.
however didn't find how turn procedure view or can use reporting.
this code:
set @sql = null; select group_concat(distinct concat( 'max(if(r.hoursmonth = ''', hoursmonth, ''', r.sumofhoursworked, null)) ''', hoursmonth, '''' ) ) @sql (select hoursmonth, sumofhoursworked report_hourspermonthperemployercode order hoursmonth) t; set @sql = concat('select distinct e.employername, ', @sql, ' employer e left join report_hourspermonthperemployername r on e.employername = r.employername group employername'); prepare stmt @sql; execute stmt; deallocate prepare stmt;
Comments
Post a Comment