1
我想問問你們中的任何人是否知道如何將or_where放在codeigniter中的某處?or_where裏面功能活躍的記錄
我想創建一個查詢,如下圖所示
select *
from table
where
(
(in = 0 and call_in = 1) or
(out = 0 and call_out = 1)
) and
mid = 0
ORDER BY id DESC
limit 1
我創建了這樣的事情
$result = $mysql_handler->select('*')
->from("table")
->where(
array(
"in" => 0,
"call_in" => 1
)
)
->or_where(
array(
"out" => 0,
"call_out" => 1
)
)
->where("mid", 0)
->order_by("id", "DESC")
->limit(1)
->get();
但我知道這是不對的,因爲這些代碼會產生這樣的
select *
from table
where
(in = 0 and call_in = 1) or
(out = 0 and call_out = 1) and
mid = 0
ORDER BY id DESC
limit 1
我想將or_where放在where子句中,但我不確定if這是正確的或如何做到這一點。請建議謝謝。
是否有內部 的方式,其中('((在= 0和call_in = 1)或(滿分= 0和call_out = 1) )') 使它像一個準備的聲明?像 其中('((in =?和call_in =?)OR(out =?和call_out =?))',array(0,1,0,1)) 我不確定這是否可能 – 2015-03-14 06:35:09