需要帮助,查询 select 中的 isnull 错误

need help, bug in query select with isnull

我认为这可能是 yii2 中的一个错误, 当我使用:

$query->select ("isnull(cba.HSLET,0)");
$query->join('INNER JOIN','cba','cba.id = regverification.cba_id');

yii miss create the sql sentence resulting in a error near:

isnull(cba.HSLET, [0)]

来自Yii 2 Guide

Besides column names, you can also select DB expressions. You must use the array format when selecting a DB expression that contains commas to avoid incorrect automatic name quoting.

所以应该是:

$query->select(["ISNULL(cba.HSLET, 0)"]);