欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

postgresql之greenplum字符串去重拼接方式

 更新時間:2023年05月05日 16:36:23   作者:gxpjoe  
這篇文章主要介紹了postgresql之greenplum字符串去重拼接方式,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教

postgresql greenplum字符串去重拼接

pg 、gp 實現(xiàn) collect_set  效果:

array_agg(DISTINCT $columnName))
array(SELECT DISTINCT ? $columnName ?from $tableName )

字符串拼接 :

array_to_string(array_agg(DISTINCT ), '|')?

postgresql字符串處理方式

關(guān)于查找字符串

select position('hello' in 'test_sql')?
output:0
select position('test' in 'test_sql')?
output:1

故可用position(str_1 in str_2) != 0判斷str_1是否是str_2的子串。

字符串與數(shù)字的相互轉(zhuǎn)換

字符串->數(shù)字

to_number(block_id,'999999')和cast(block_id as numeric),但前一句會限定的數(shù)字大小為10的5次方,即過大的數(shù)值會出問題,而后一句不會。

數(shù)字->字符串

cast(block_id as varchar)將數(shù)值型轉(zhuǎn)為字符串型。

總結(jié)

以上為個人經(jīng)驗,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論