diff --git a/core/modules/views/src/Plugin/views/query/Sql.php b/core/modules/views/src/Plugin/views/query/Sql.php
index 7e24d94..c88b500 100644
--- a/core/modules/views/src/Plugin/views/query/Sql.php
+++ b/core/modules/views/src/Plugin/views/query/Sql.php
@@ -1266,6 +1266,9 @@ public function query($get_count = FALSE) {
     // Add groupby.
     if ($groupby) {
       foreach ($groupby as $field) {
+        if ($field == $this->view->storage->get('base_field')) {
+          $field = $this->view->storage->get('base_table') . '.' . $field;
+        }
         $query->groupBy($field);
       }
       if (!empty($this->having) && $condition = $this->buildCondition('having')) {
