Zend_Db_Table_Abstract - How to do a SUM?

MEM picture MEM · Nov 24, 2010 · Viewed 7.2k times · Source

I can't find here: http://framework.zend.com/manual/en/zend.db.select.html any reference to SUM using mysql.

How can we perform a simple:

SELECT SUM(mark) as total_mark FROM `student`

Using Zend_Db_Table_Abstract ?

Tried:

this->select(SUM ('myintcolumn'))->from('mytable');

No luck. :(

Thanks, MEM

Answer

aletzo picture aletzo · Nov 24, 2010

did you try

this->select()->from('mytable', array('sum(myintcolumn) as sum'));