--- views_query.inc.orig	2007-04-09 22:11:07.000000000 -0700
+++ views_query.inc	2007-04-09 22:12:43.000000000 -0700
@@ -405,6 +405,9 @@
       }
       $this->add_field($f, $table, $as);
       $this->orderby[] = "$as $order";
+	  if ($this->groupby) {
+        $this->add_groupby($as);
+      }
     }
   }
 
