0
我想我的查詢爲:CakePHP的多重嵌套查詢
$conditions = array(
'ManageTrackby.trackby_num NOT LIKE' => '%n/a%',
'Balancesheet.subscriber_id' => $_SESSION['Auth']['User']['subscriber_id'],
'Balancesheet.show_id' => $this->Session->read('openshowid'),
'OR' => array('Balancesheet.season_id' => $season_id, 'Balancesheet.season_id is null'),
'OR' => array('Balancesheet.episode_id'=> $episode_id, 'Balancesheet.episode_id is null')
);
其中這裏跳過最後OR
選項,並得到下述結果:
Array
(
[ManageTrackby.trackby_num NOT LIKE] => %n/a%
[Balancesheet.subscriber_id] => 105
[Balancesheet.show_id] => 56
[OR] => Array
(
[Balancesheet.episode_id] => 86
[0] => Balancesheet.episode_id is null
)
)
這裏,從錯過SEASON_ID
條件,任何想法爲什麼?
請指導我!
這是你想要的查詢嗎? 'Balancesheet.season_id = $ season_id OR Balancesheet.season_id = Null AND Balancesheet.episode_id = $ episode_id OR Balancesheet.episode_id = Null' – Bob