如何将此sql查询转换为cakephp 3 Query Builder?

时间:2017-01-12 10:41:52

标签: mysql cakephp-3.0

SELECT IF(approved = 1,'Yes','No') AS Status
FROM support;

1 个答案:

答案 0 :(得分:1)

$supportTable = TableRegistry::get('Support');
$support = $supportTable->find()->select(["status" => "IF(approved = 1,'Yes','No')"])->toArray();

你可以尝试这个