例如,我有一個Store模型,其字段爲H和toH,我想從數據庫中檢索在給定小時(@t)打開的存儲。CakePHP複雜查找條件
SQL查詢應該是這樣的
select *
from store
where
(fromH < toH and @t between fromH and toH) or
(fromH > toH and
(@t between fromH and 24 OR
(@t between 1 and toH)
)
如何實現CakePHP的這個查詢,怎麼會條件陣列看?我想做蛋糕風格。
當我嘗試運行此查詢時,我得到以下錯誤:錯誤:SQLSTATE [42S22]:未找到列:1054'where子句'中的未知列'15' - 「15」是@t – user1399007
Can你請在這裏發佈你的條件查詢代碼? – dirtyhandsphp