亚洲欧美日本A∨在线观看_黑人video粗暴亚裔_JAPANESE日本丰满少妇_九九精品91久久久久久再现_国产MD视频一区二区三区

首頁(yè) > 聚焦 >

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

發(fā)表時(shí)間:2023-05-06 06:11:41 來(lái)源:腳本之家


(資料圖)

目錄
postgresql greenplum字符串去重拼接postgresql字符串處理方式關(guān)于查找字符串字符串與數(shù)字的相互轉(zhuǎn)換總結(jié)

postgresql greenplum字符串去重拼接

pg 、gp 實(shí)現(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),但前一句會(huì)限定的數(shù)字大小為10的5次方,即過(guò)大的數(shù)值會(huì)出問(wèn)題,而后一句不會(huì)。

數(shù)字->字符串

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

總結(jié)

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

標(biāo)簽:

Copyright ©  2015-2022 太平洋產(chǎn)業(yè)網(wǎng)版權(quán)所有  備案號(hào):豫ICP備2022016495號(hào)-17   聯(lián)系郵箱:93 96 74 66 9@qq.com