It is necessary for each line to change the words, so that it was in the reverse order: Cool Heroes Blvd., Primіska 1-a vulitsya, and so on
1 answer
We turn a string into an array of words, break it into separate elements of the array, numbered in reverse order, and collect it back into an array and then into a string.
select array_to_string(array_agg(arr[i] order by i desc),' ') from ( select str_streetname, regexp_split_to_array(str_streetname,' +') arr from Q ) A inner join lateral (select i from generate_series(array_length(A.arr,1),1,-1) as s(i)) X on 1=1 group by str_streetname - Pliz write more with the update line in the database - Sanyo4ever
- In addition, it changes only two words, but it no longer works for 3: it changes the last two - Sanyo4ever
- @ Sanyo4ever Strange, for my string 'abc def xyz' gave 'xyz def abc'. - Mike
- "Kruty Hero boulevard" "Primіska 1-a vulitsya" "2-a Primіska vulytsya" "28 Chervnya vulytsya"
- For some reason, not all lines worked - Sanyo4ever
|
