如何在 codeigniter 中为同一列创建 MULTIPLE LIKE 查询?
How to create MULTIPLE LIKE query for the same column in codeigniter?
假设我想获取文本列中同时包含三个词(word1、word2、word3)的所有行
所以我的 sql 会是
SELECT
*
FROM
mytable
WHERE
col_text LIKE '%word1%'
AND col_text LIKE '%word2%'
AND col_text LIKE '%word3%'
codeigniter 中有 and_like 吗?
向查询构建器提供三个 like()
将默认为每个 AND
:
$this->db
->from( "mytable" )
->like( "col_text", 'word1', 'both' )
->like( "col_text", 'word2', 'both' )
->like( "col_text", 'word3', 'both' );
假设我想获取文本列中同时包含三个词(word1、word2、word3)的所有行
所以我的 sql 会是
SELECT
*
FROM
mytable
WHERE
col_text LIKE '%word1%'
AND col_text LIKE '%word2%'
AND col_text LIKE '%word3%'
codeigniter 中有 and_like 吗?
向查询构建器提供三个 like()
将默认为每个 AND
:
$this->db
->from( "mytable" )
->like( "col_text", 'word1', 'both' )
->like( "col_text", 'word2', 'both' )
->like( "col_text", 'word3', 'both' );