postgresql 合并文本[]
我可以知道如何根据标识符合并数组:
Column1 Column2
--------------------------
1 {"a","b"}
1 {"c"}
2 {"d"}
2 {"w"}
输出:
Column1 Column2
--------------------------
1 {"a","b","c"}
2 {"d","w"}
已尝试 array_agg 但这不是合并数组的适当函数。目前使用8.4版本。
can I know how do i merge arrays according to an identifier:
Column1 Column2
--------------------------
1 {"a","b"}
1 {"c"}
2 {"d"}
2 {"w"}
output:
Column1 Column2
--------------------------
1 {"a","b","c"}
2 {"d","w"}
Have tried array_agg but that is not the appropriate function for merging the array. using version 8.4 at the moment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您的表是“a”,受影响的列是“n”和“t”:
And assuming your table is "a" and the columns affected are "n" and "t":