pg 多列合并一列

 

下面是正常的查询多条数据,如果我要合并成列怎么办。

   pg 多列合并一列

  其实pg有自带的array_to_string函数 ,但是写法稍微有点麻烦,但是可以根据array_to_string函数自定义一个函数去简化写法。

	CREATE AGGREGATE group_concat(anyelement)(
	sfunc = array_append,
	stype = anyarray,
	initcond = '{}'
	); 

  然后使用函数去指定字符串去分割就行了    

  pg 多列合并一列

 

上一篇:C# winform 界面美化技巧(扁平化设计) (转)


下一篇:数组和指针