diff --git a/core/lib/Drupal/Core/Database/Query/Condition.php b/core/lib/Drupal/Core/Database/Query/Condition.php
index 5169357..a23f003 100644
--- a/core/lib/Drupal/Core/Database/Query/Condition.php
+++ b/core/lib/Drupal/Core/Database/Query/Condition.php
@@ -72,6 +72,13 @@ class Condition implements ConditionInterface, \Countable {
   protected $stringVersion;
 
   /**
+   * Whether this condition is nested inside an OR condition.
+   *
+   * @var bool
+   */
+  public $nestedInOrCondition = FALSE;
+
+  /**
    * Constructs a Condition object.
    *
    * @param string $conjunction
diff --git a/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php b/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
index 00fe78c..0292c10 100644
--- a/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
+++ b/core/lib/Drupal/Core/Entity/Query/Sql/Condition.php
@@ -36,11 +36,12 @@ public function compile($conditionContainer) {
         $sql_condition = new SqlCondition($condition['field']->getConjunction());
         // Add the SQL query to the object before calling this method again.
         $sql_condition->sqlQuery = $sql_query;
+        $sql_condition->nestedInOrCondition = strtoupper($this->conjunction) == 'OR';
         $condition['field']->compile($sql_condition);
         $conditionContainer->condition($sql_condition);
       }
       else {
-        $type = strtoupper($this->conjunction) == 'OR' || $condition['operator'] == 'IS NULL' ? 'LEFT' : 'INNER';
+        $type = strtoupper($this->conjunction) == 'OR' || ($conditionContainer instanceof SqlCondition && $conditionContainer->nestedInOrCondition) || $condition['operator'] == 'IS NULL' ? 'LEFT' : 'INNER';
         $field = $tables->addField($condition['field'], $type, $condition['langcode']);
         $condition['real_field'] = $field;
         static::translateCondition($condition, $sql_query, $tables->isFieldCaseSensitive($condition['field']));
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
index 763fa44..3ca482d 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
@@ -513,7 +513,7 @@ public function testNestedConditionGroups() {
       ->sort('id')
       ->execute();
 
-    $this->assertResult(6, 14);
+    $this->assertResult(4, 6, 12, 14);
   }
 
   /**
