こんにちは、どうすれば drupal でそのような条件を実行できますか?
WHERE (date = xxx and time = xxx) OR (date = xxx and time = xxx)
db_select でこの条件を実行したいと考えています。
ありがとう。
こんにちは、どうすれば drupal でそのような条件を実行できますか?
WHERE (date = xxx and time = xxx) OR (date = xxx and time = xxx)
db_select でこの条件を実行したいと考えています。
ありがとう。
速い答えのためのthx、私はそれを見つけました。
ここに私の解決策があります:
$and_1 = db_and()->condition('b.date' , $date, '=')->condition('b.time', $begin_time, '>');
$and_2 = db_and()->condition('b.date' , $tomorrow, '=')->condition('b.time', '00:00', '>=')
$query->condition(db_or()->condition($and_1)->condition($and_2));
このような:
$query = db_select('yourtable', 't');
$query->condition(db_or()->condition(db_and()->condition('t.date', xxx, '=')->condition('t.time', xxx, '='))
->condition(db_and()->condition('t.date', xxx, '=')->condition('t.time', xxx, '=')));