How to find the first and last occurrences of a specific character inside a string in PostgreSQL

前端 未结 7 1161
闹比i
闹比i 2021-01-11 20:26

I want to find the first and the last occurrences of a specific character inside a string. As an example, consider a string named \"2010-####-3434\", and suppose the charact

7条回答
  •  北海茫月
    2021-01-11 20:43

    My example:

    reverse(substr(reverse(newvalue),0,strpos(reverse(newvalue),',')))
    
    1. Reverse all string
    2. Substring string
    3. Reverse result

提交回复
热议问题