0

I have a column get_parameter in my table comments.

A get_parameter is a string that looks like this:

number1=7013448034

I need to extract the number from the above so that I'm left with just 7013448034.

How can I select that substring and get rid of number1= using PostgreSQL?

2 Answers 2

2
SELECT SUBSTRING(get_parameter from '[0-9]*$') FROM comments
Sign up to request clarification or add additional context in comments.

Comments

1

Here is another way of doing it. I think using the array functions might be useful.


SELECT num[2] FROM (SELECT regexp_split_to_array('number1=7013448034', E'=') as num) as query;

Check out

for more information.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.