Yue Yue - 1 year ago 74
SQL Question

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




Data are splitted 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?

Please help, thanks!

Answer Source

you can use select split_part(colname,';',2);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download