与Drupal db_select的条件和OR

alt*_*ore 3 sql where conditional-statements drupal-7

嗨我怎么能在drupal中做这样的情况?

WHERE (date = xxx and time = xxx) OR (date = xxx and time = xxx)
Run Code Online (Sandbox Code Playgroud)

我想用db_select来做这个条件.

谢谢.

alt*_*ore 8

为了快速回答,我发现了它.

这是我的解决方案:

$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));
Run Code Online (Sandbox Code Playgroud)