原始查询:
select firstfield, secondfield, phone_number, thirdfield
from table
having CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value'
and CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value2'
and CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value3'
and CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value4'
查询生成器
$qb->select(
'firstfield',
'secondfield',
'thirdfield',
'fourthfield',
)->from(Table, 'u');
$queryHaving = "CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value'";
$qb->andhaving($queryHaving);
$queryHaving = "CONCAT(firstfield, ' ', secondfield, ' ', thirdfield, ' ', fourthfield) regexp 'value2'";
$qb->andhaving($queryHaving);
问题:
如何用正则表达式收集 concat 不是函数?尝试使用 literal() 函数,但无法在无法分配的情况下创建应有的错误抛出。