0

I have a column in my Postgres database table which contains a value with some whitespaces in between. For example, a value present in the column is '123 1062 10'.

Now, I want to write an SQL query which can return the row which contains the above-mentioned value by passing in the value '123106210' in the where clause of SQL Query.

Any ideas of how can write to the SQL Query to get the desired result?

1 Answer 1

2

replace function does not work for you?

This works

select replace('123 1062 10',' ','')::bigint

so this could be your final select:

select ...
from ...
where replace(your_text_column,' ','')::bigint = 123106210
Sign up to request clarification or add additional context in comments.

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.