时间:2021-07-01 10:21:17 帮助过:3人阅读
SET @EE=‘‘;
SELECT @EE:=GROUP_CONCAT(@EE,‘sum(if(val=\‘‘,val,‘\‘‘,‘,id,0)) as ‘,‘‘‘‘,val,‘‘‘‘) from (select DISTINCT val from hl_test)a;
SET @str=CONCAT(‘select ‘,@EE,‘ from hl_test group by id‘);
PREPARE stmt from @str;
EXECUTE stmt;
mysql 行转列
标签:mys distinct tin group exe mysq val mysql sel