yii2 中的 LIKE AND LIKE 语句
LIKE AND LIKE statement in yii2
这是我想要的查询:
SELECT * FROM `elenchi` WHERE ConvMon LIKE '%bol%' AND ConvMon LIKE '%maria%'
谁能帮我用 Yii2 语法转换这个查询?
我暂时建立了这个查询,但错误:
if($this->ConvMon) {
$query->andWhere(['like',"ConvMon",$this->ConvMon]); //this is the problem
}
试试这个
提供第三个元素作为数组来实现这个查询
$query->andWhere(['like', 'ConvMon', ['bol', 'maria']]);
这条生产线生产
WHERE ConvMon LIKE '%bol%' AND ConvMon LIKE '%maria%'
这是我想要的查询:
SELECT * FROM `elenchi` WHERE ConvMon LIKE '%bol%' AND ConvMon LIKE '%maria%'
谁能帮我用 Yii2 语法转换这个查询?
我暂时建立了这个查询,但错误:
if($this->ConvMon) {
$query->andWhere(['like',"ConvMon",$this->ConvMon]); //this is the problem
}
试试这个 提供第三个元素作为数组来实现这个查询
$query->andWhere(['like', 'ConvMon', ['bol', 'maria']]);
这条生产线生产
WHERE ConvMon LIKE '%bol%' AND ConvMon LIKE '%maria%'