I already had help here .
But when I tried switching from spaces to commas it didn't work
Basically if I have an address:
FLAT 10, ELGAR HOUSE, CHURCHILL GARDENS, LONDON, SW1V 3BS
I need to cut it and have as output only
FLAT 10, ELGAR HOUSE
How to do it in postgresql?
I guess you could use split_part
function to get string before occurrence of 2nd comma
select split_part(address, ',', 1) || ',' || split_part(address, ',', 2)
from your_table
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.