Drupal Answers is a question and answer site for Drupal developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have view of teasers which one has united filed.

Is there a way to add "group by" by this field (join field table and group by the field) into sql query of view?

share|improve this question

In Views 3, under "advanced settings", there is a setting for enabling aggregation, which will give you group by options.

Most likely they are hidden by default as the UI is complicated enough as is.

You can also check out chapters 28-30 in the NodeOne Taming the beast learn views with nodeone which are all about aggregation.

share|improve this answer
thanks, lets see – Luciuz Jun 5 '12 at 15:14

Letharion's answer already explains the essential stuff. Nevertheless I'd like to clarify things a bit more to make it easier to find this Q&A. I lost like one or two hours for this, because they changed the name of this property.

In SQL the function is called GROUP BY (see here in the MySQL manual). A typical use case is after a JOIN in order to get the min/max/average value of certain rows or to count certain rows after a JOIN.

To allow to create such queries with Drupal's views module in Drupal 6 there was the module views_groupby.

In Drupal 7 this is working out of the box. But this option is not called group by or grouping anymore, it is called enable aggregation!

Some links to discussions in the past:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.