Skip to main content
Question
Asked a question 3 months ago

Postgress DB, I need to return just the first and then the second part of a field based on "," as a seperator, field contains "abcd, 12345, zyxw" I need to have a fomula return just "abcd" or "12345"

Where am I?

In DashboardFox you can ask and answer questions and share your experience with others!

Rob,

   Please take a look at the PostgreSQL function split_part().

Example:

split_part('abcd, 12345, zyxw', ',',2)

should return: 12345

Note: if you have spaces in the string you may need to then trim them:

trim(split_part('abcd, 12345, zyxw', ',',2))

Thanks,

Dennis

Related Questions

No related questions.