标签:mys distinct tin group exe mysq val mysql sel
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;
标签:mys distinct tin group exe mysq val mysql sel
原文地址:https://www.cnblogs.com/bignine/p/10090990.html