Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers 2

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
add comment

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
add comment

Your Answer

 
discard

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.