Reputation: 47
How do I get all numbers after slash in my column?
Example: 884/9
and 884/12
I need to get it as "9" and "12".
This one doesn't work - I am using Postgres and Dibi library
substring(source_path, '/(.*)$')
Upvotes: 1
Views: 5020
Reputation: 40481
If you have only one /
on your data, and it is always formatted similar to the example you gave, then you can use SPLIT_PART()
:
SELECT split_part(source_path, '/', 2) FROM YourTable;
Although I think your query should work. What exactly 'doesn't work' means ?
Upvotes: 3