How to query for null in nested db_or conditional I am trying to perform a query as listed below (notice the check for NULL)

$query = db_select('node', 'n');
/* add fields and joins... */
$query-&gt;condition(db_or()
      -&gt;condition(db_and()
                  -&gt;condition('join_alias1.field_date_unassigned_value', NULL, 'IS')
                  -&gt;condition('join_alias2.field_date_assigned_value', $end_date, '&lt;='))
      -&gt;condition(db_and()
                  -&gt;condition('join_alias1.field_date_unassigned_value', $start_date, '&gt;=')
                  -&gt;condition('join_alias2.field_date_assigned_or_submitted_value', $end_date, '&lt;=')));


I am aware that Drupal expects Null values to be checked like

$query-&gt;isNull('myfield');


But I don't understand how to perform a query like I listed above while using $query-&gt;isNull().

Any ideas? Thanks
You can use isNull() in the db_and() condition, it'll work just fine:

$query-&gt;condition(db_or()
  -&gt;condition(db_and()
    -&gt;isNull('join_alias1.field_date_unassigned_value')
    -&gt;condition('join_alias2.field_date_assigned_value', $end_date, '&lt;=')
  )
  -&gt;condition(db_and()
    -&gt;condition('join_alias1.field_date_unassigned_value', $start_date, '&gt;=')
    -&gt;condition('join_alias2.field_date_assigned_or_submitted_value', $end_date, '&lt;=')
  )
);