【发布时间】:2017-09-06 17:43:21
【问题描述】:
我想把每一行的单元格变成一串名字……我的方法已经处理了大小写。
例如,桌子;
'john' | | 'smith' | 'smith'
'john' | 'paul' | | 'smith'
'john' | 'john' | 'john' |
返回:
'john smith'
'john paul smith'
'john'
这需要运行 postgres 的 postgreSQL 8.2.15,因此我无法使用 CONCAT 等潜在有用的功能,并且数据位于 greenplum db 中。
另外,一种直接删除字符串列表中重复标记的方法可以让我实现更大的目标。例如:
'john smith john smith'
'john john smith'
'smith john smith'
返回
'john smith'
'john smith'
'smith john'
标记的顺序并不重要,只要返回所有唯一值,只返回一次。
谢谢
【问题讨论】:
-
这似乎是一个糟糕的数据库设计,我认为您需要一个应用层。
标签: sql postgresql distinct string-aggregation