Postgresql之split_part()切割函数,取最后一部分

split_part(string text, delimiter text2, field int)
text要切割的字段; text2按照什么形式切割 int截取的位置
ps:
text=“name.cn” split_part(text,’.’,1) 结果: name
text=“name.cn” split_part(text,’.’,2) 结果: cn
text=“name.cn.com” split_part(text,’.’,3) 结果: com
 

split_part(field, '-', length(replace(field, '-', '--')) - length(field) +1)

你可能感兴趣的:(数据库)