返回字符串末尾的文本-Presto SQL
我试图返回字符串末尾的文本返回字符串末尾的文本-Presto SQL,sql,amazon-athena,presto,Sql,Amazon Athena,Presto,我试图返回字符串末尾的文本 Example #1- ad | aff | 11_32_32_Desired - Text Example #2- ad | aff | 11_32_32_Desired Text 这是我的专栏中的两个变体,有时所需文本的长度在我的数据中会发生变化。我试图将所需的文本值放入它们自己的列中。有些行有-有些行没有 谢谢 Presto SQL支持,请尝试: 如果您想要的是最后一次出现之后的字符串部分,则: select substr(col, length(col) -
Example #1- ad | aff | 11_32_32_Desired - Text
Example #2- ad | aff | 11_32_32_Desired Text
这是我的专栏中的两个变体,有时所需文本的长度在我的数据中会发生变化。我试图将所需的文本值放入它们自己的列中。有些行有-有些行没有
谢谢 Presto SQL支持,请尝试:
如果您想要的是最后一次出现
之后的字符串部分,则:
select substr(col, length(col) - strpos(reverse(col), '_') + 2)
请显示您想要的结果。并明确专栏的内容。
select substr(col, length(col) - strpos(reverse(col), '_') + 2)