views:

27

answers:

1

Hey

Any Ideas how I can build the following query with the zend_db_table class?

SELECT SUM(x) FROM traffic

thanks

A: 

I don't actually use Zend_Db_Table at all, but if you know how to configure basic queries, use this expression instead

$ZendDBTable->columns(new Zend_Db_Expr('SUM(x)');

Read it as pseudocode, I don't know the syntax of Zend_Db_Table. The new Zend_Db_Expr('some mysql keywords') is used to let the engine know that you have a keyword in the query which should not be escaped.

michal kralik