pivot - error in my procedure while pivoting table -


i have following procedure

delimiter $$  create definer=`root`@`localhost` procedure `samp`() begin declare startdate date; declare enddate date;  set session group_concat_max_len = 3000000000;  select min(from_date) startdate requestor_employees emp_code=2145;  select max(to_date) enddate requestor_employees emp_code=2145; call fill_calendar(startdate,enddate); set @test =(select concat('select concat(em.fname,'',em.mname,'',em.lname) project_manager,pm.project_name,re.req_id,re.from_date,re.to_date requestor_employees re inner join requestor_master rm on re.req_id=rm.req_id inner join project_master pm on rm.project_auto_id=pm.project_auto_id inner join employee_master em on pm.pm_emp_code=em.emp_code re.emp_code=@id , re.flag in("na","ma","nd","md") group pm.project_name'));         set @result= (select distinct concat('select project_name,',group_concat(months),' (',@test,') `e`')from( select concat('select ',    year(datefield),' year  ,"" "jan"  ,"" "feb"  ,"" "mar"  ,"" "apr"  ,"" "may"  ,"" "jun"  ,"" "jul"  ,"" as"aug"  ,"" "sep"  ,"" "oct"  ,"" "nov"  ,"" "dec"') months calendar) d);     prepare stmt @result;     execute stmt;     deallocate prepare stmt;  end 

i error in pivot table below:

call samp() error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'select 2016 year ,"" "jan" ,"" "feb" ,"" "mar" ,"" "apr" ,""' @ line 1 1.030 sec don't know going wrong new procedure , pivoting.someone me solve this


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -