Reputation: 49
If i have the string:
[30.345, -97.345, 4],[30.345, -97.345, 5],[30.345, -97.345, 6],[30.345, -97.345, 7]
How would i remove every third comma, so that the string would look like this?
[30.345, -97.345, 4][30.345, -97.345, 5][30.345, -97.345, 6][30.345, -97.345, 7] ?
Thanks in advance.
Upvotes: 1
Views: 1205
Reputation: 4694
sql is to general, need more info.
Here is ORACLE:
select replace('your string', '],[', '][') from dual
Upvotes: 2
Reputation: 15875
how about replacing ],[
with ][
SELECT REPLACE('[30.345, -97.345, 4],[30.345, -97.345, 5],[30.345, -97.345, 6],[30.345, -97.345, 7].','],[','][');
Upvotes: 5
Reputation: 4403
I would use the REPLACE MySQL function.
Here is a link to some documentation on how to implement it: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_replace
Something like:
SELECT REPLACE('[30.345, -97.345, 4],[30.345, -97.345, 5],[30.345, -97.345, 6],[30.345, -97.345, 7]', '],[', '][');
Upvotes: 0