Hi,
first of all, I want to say that Datamapper is great.
But I have a question.
Let's say I have the following models:

class Post
  include DataMapper::Resource
  property :id, Integer, :serial => true
  property :content, Text
  has n, :comments
end

class Comment
  include DataMapper::Resource
  property :id, Integer, :serial => true
  property :content, Text
  belongs_to :post
end


Is it possible to make a query via Datamapper like "give me the posts
with the most comments"

in sql it would be:
SELECT posts.*
FROM posts JOIN comments on posts.id=comments.post_id
GROUP BY posts.id
ORDER BY count(comment.id) DESC
LIMIT 10

can I make a query like that in datamapper without having an explicit
"comment_count" field?

thanks!
Ernst
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to