Php 带问号?、?|、?&;的运算符的Yii Postgress Json查询;
如何将SQL查询写入与运算符?、?|、?&匹配的where条件Php 带问号?、?|、?&;的运算符的Yii Postgress Json查询;,php,postgresql,yii,conditional-statements,jsonb,Php,Postgresql,Yii,Conditional Statements,Jsonb,如何将SQL查询写入与运算符?、?|、?&匹配的where条件 id : 12, name: 'Harry Pottor', type: ['Fiction', 'Horror', 'Adventure' ] 在Yii中,当我为JSON数组编写查询时,使用?&操作符检查会给出错误。此查询在pgAdmin中成功运行 SELECT id, name FROM books WHERE type ?& array['Fiction', 'Horror'] $commandSql = $
id : 12,
name: 'Harry Pottor',
type: ['Fiction', 'Horror', 'Adventure' ]
在Yii中,当我为JSON数组编写查询时,使用?&
操作符检查会给出错误。此查询在pgAdmin中成功运行
SELECT id, name
FROM books
WHERE
type ?& array['Fiction', 'Horror']
$commandSql = $connection->createCommand($sql);
但是,?
标记运算符被替换为$1,即使用绑定值
在Yii中如何进行此类查询?我面临同样的问题
SELECT * FROM company WHERE jsonb_exists_all(technology::jsonb, array['ERP']);
或
请参阅此链接
我也面临同样的问题
SELECT * FROM company WHERE jsonb_exists_all(technology::jsonb, array['ERP']);
或
请参阅此链接