Yes...
i have no time to give you the code .
But mainly yes...
$c = new Criteria();
$c->addJoin(ArticlesPeer::ID,CommentsPeer::ARTICLE_ID,Criteria::LEFT_JOIN);
$c->addSelectColumn(ArticlesPeer::TITLE);
$c->addAsColumn("COUNT(".CommentsPeer::ID.")");
$c->addGroupBy(ArticlesPeer::TITLE);

you'll have to execute basePeer::doSelect($c)

how ever, i'd make it simpler...

$c = new Criteria();
$c->add(CommentsPeer::ARTICLE_ID, $id );
$c->GroupBy(CommentsPeer::ARTICLE_ID);
return CommentsPeer::doCount($c);

On Tue, Sep 22, 2009 at 4:58 PM, korfos <[email protected]> wrote:

>
> Hello all,
>
> I want to create the following query using propel:
>
> SELECT acticles.title, count(comments.id)
> FROM articles
> LEFT JOIN comments ON comments.article_id = articles.id
> group by articles.title
>
> Is this posible?
>
> Regards,
> Radu.
>
> >
>


-- 
As programmers create bigger & better idiot proof programs, so the universe
creates bigger & better idiots!
I am on web:  http://www.alecslupu.ro/
I am on twitter: http://twitter.com/alecslupu
I am on linkedIn: http://www.linkedin.com/in/alecslupu
Tel: (+4)0748.543.798

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to