yes i did, it didn't work because i need to group it by that same
column.
I created a custom method that groups & returns the totals. Something
like this

  public function sumUserTotal() {
    $result = $this->withColumn('SUM(dbTimeBlock.Total)',
'Total','Int')->groupBy('dbTimeBlock.ProfileId')->findOne();
    return $result ? $result->getColumn('Total') : 0;
  }

that works, tnx francois, it's a great plugin !

On Sep 23, 11:06 pm, "Francois Zaninotto" <[EMAIL PROTECTED]
project.com> wrote:
> Hi,
>
> Did you try:
>
> $article = sfPropelFinder::from('dbTimeBlock')->
>   withColumn('sum(dbTimeBlock.Total)', 'total')->
>   findOne();
> $sum = article->getColumn('total');
>
> François
>
> 2008/9/23 DigitalBase <[EMAIL PROTECTED]>:
>
>
>
> > Hi, we are using propel addSelectColumn functionality to do a SUM on
> > database level without object hydratation like this :
>
> > $c = new Criteria();
> > $c->addSelectColumn('sum('.dbTimeBlockPeer::TOTAL.') as total');
>
> > $rs = dbTimeBlockPeer::doSelectRS($c);
> > while ($rs->next()) { $total = $rs->getInt(1); }
>
> > return $total;
>
> > Now i am cleaning all my *Peer custom methods by dbFinder ones, but i
> > haven't figured out howto do a sum() and returning a non-hydrated
> > resultset.
>
> > would be nice to have something like :
> > $article = sfPropelFinder::from('dbTimeBlock')->
> >  getSum(dbTimeBlock.total)
>
> > Is there anyway i could do this with dbFinder ?
>
>
--~--~---------~--~----~------------~-------~--~----~
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