首页 > 解决方案 > 如何在字符串中插入列值?

问题描述

如何在字符串中插入列值(postgres,python)

select * from table where title ~* '\y(?:ROW_VALUE_HERE)\y'

标签: pythonpostgresql

解决方案


使用字符串连接运算符||

select * from table where title ~* '\y(?:' || my_column || ')\y';

format功能:

select * from table where title ~* format('\y(?:%s)\y', my_column)';

推荐阅读