简体   繁体   English

如何在PostgreSQL中将特殊字符串视为数组并从中选择第二个对象

[英]How do I treat a special string as an array and select the second object from it in postgreSQL

I have a column in my table which has values like this 我的表格中有一列具有这样的值

1923195445602;182343;en

or 要么

1830310365602;175824;en;EVENT

Data is split by ";" 数据用“;”分隔

I want to select the second value of it. 我想选择它的第二个值。 My thought is to find a way to treat this string as an array. 我的想法是找到一种将该字符串视为数组的方法。 Or is there a better way? 或者,还有更好的方法?

您可以使用select split_part(colname,';',2);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM