<p>Is it possible to use an attribute of a child to group a query?</p>

<pre><code>Post.find(:all, :include =&gt; [ :authors, :comments ], :group=&gt;'authors.city') 
</code></pre>

<p>does not work. </p>

<p>However, I am able to use <code>author.city</code> as part of the conditions.</p>

If that's what you're using, then the syntax is wrong for the :group argument, it should be:
```
```
Post.find(:all, :include => [ :author, :comments ], :group=>'authors.city')
```
```
Make sure your :author and :comments associations are correct.  If 'authors' is the actual table name, then you'll need a 'has_one :author' association in you Post model, and an  Author model.
Associations need to be correct, too:
```
```
class Post < AR:Base
   belongs_to :author
   has_many :comments
 end

 class Author < AR:Base
   has_many :posts
 end

 class Comment < AR:Base
   belongs_to :post
 end
```
```
And the db schema:
```
```
posts
   id
   author_id
 authors
   id
 comments
   id
   post_id
```
```
This will let the query run correctly, however, now
I'm
getting an error with the results... the :group clause doesn't seem to be applied when :include is used.