-1
Cake正在逃避Contract.start_date
和Contract.end_date
,導致查詢無效。cakePHP在BETWEEN條件下將字段名作爲字符串轉義
$this -> Contract -> find('all', array(
'fields' => array(..),
'conditions' => array(
'NOW() BETWEEN ? AND ?' => array(
'Contract.start_date',
'Contract.end_date'
)
)
));
的問題是執行的查詢是
SELECT
<fields> AS Monthly
FROM
`contracts` AS `Contract`
WHERE
NOW() BETWEEN 'Contract.start_date' AND 'Contract.end_date'
#/* field names are escaped and treated as strings */