Any Ideas how I can build the following query with the zend_db_table class?
SELECT SUM(x) FROM traffic
thanks
Any Ideas how I can build the following query with the zend_db_table class?
SELECT SUM(x) FROM traffic
thanks
Slightly more descriptive code sample:
$table = new DbTable_Traffic(); //extends Zend_Db_Table
$select = $table->select()->columns('SUM(X)');
Expressions containing ()
will be transformed to Zend_Db_Expr
automatically.
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.