需要将上面这种结果集转化为下图所示格式:
pg9.x版本可以结合分组函数GROUP BY与string_agg(col,'')实现;
具体写法如下:
select string_agg(behavior_code,'<br />') as behavior_code,factor_code
from t_evaluation_behavior
group by factor_code order by factor_code;
需要将上面这种结果集转化为下图所示格式:
pg9.x版本可以结合分组函数GROUP BY与string_agg(col,'')实现;
具体写法如下:
select string_agg(behavior_code,'<br />') as behavior_code,factor_code
from t_evaluation_behavior
group by factor_code order by factor_code;