pg中怎么查找字符串位置
在pg中查找字符串位置可以使用POSITION
函数。在查询中,你可以使用以下语法:
SELECT POSITION('substring' IN 'string');
例如,如果你想要在字符串'Hello, World!'
中查找子字符串'World'
的位置,你可以这样写:
SELECT POSITION('World' IN 'Hello, World!');
这将返回子字符串'World'
在'Hello, World!'
中的起始位置。