【发布时间】:2016-08-10 08:30:41
【问题描述】:
我们如何在 where 条件下使用计算域?
假设
$query = $this->table1
->find('all')
->select(['total_count' => '(SELECT count(*) FROM table2 where table2.fid = table1.id)'])
->autoFields(true)
->contain([
'table2', 'table3'
])
->where(['total_count >' 1]);
未找到列:1054 未知列“total_count”在哪里
有没有办法在 where 条件下使用计算字段,或者如何解决这个问题?
【问题讨论】:
标签: cakephp cakephp-3.0