2008年12月24日星期三

Re: [fw-db] How to select sum(amount) by Zend FrameWork

new Zend_Db_Expr('SUM(amount)')

$objNews->select()->from('Salary',array(new
Zend_Db_Expr('SUM(amount)')))->where("name = 'john'");

vcivilen wrote:
>
> I did, but it shown:
>
> Code:
> Uncaught exception 'Zend_Db_Table_Row_Exception' with message 'Specified
> column "SUM(amount)" is not in the row' in
> for
>
> PHP Code:
> $objNews = new Salary();
>
> $objNews->select()->from('Salary',array('SUM(amount)'))->where("name =
> 'john'");
> $objNewsArray = $objNews->fetchAll ();
> foreach($objNewsArray as $objNewsvar)
> {
> echo $objNewsvar["SUM(amount)"];
> }
> Class Salary extend from Zend_Db_Table_Abstract
>
> I've tried array('SUM(amount)') or array('thecolumn'=>'SUM(amount)'), but
> it not working properly.
>
> Please help me.
>
> Thanks,
>

--
View this message in context: http://www.nabble.com/How-to-select-sum%28amount%29-by-Zend-FrameWork-tp21156804p21156819.html
Sent from the Zend DB mailing list archive at Nabble.com.

没有评论: