Hey Marek,
You should have read on.
What you want can be done using the following code:
$select->from($ct, array('max_id' => 'MAX(place_id)'))
// et cetera
Best regards,
Tobias
--
Sent from my iPhone
Am 01.03.2008 um 19:15 schrieb Marek Wawro <[EMAIL PROTECTED]>:
Hi,
I am having problems to call MAX function in mysql using
zend_db_table_abstract
Writing that code I based on: http://framework.zend.com/manual/en/zend.db.table.html
example 10.95
here is code snipet where $ct extands Zend_Db_Table_Abstract
$select = $ct->select();
$select->from($ct, 'MAX(place_id) as max_id')->where('shop_id = ?',
0)->group('shop_id');
$max = $ct->fetchRow($select);
When i am trying to read $max->max_id i am getting exception that
this column is not existing
Thank you for help
ps:
Here is var_dump of $max variable
object(Zend_Db_Table_Row)#47 (8) {
["_data:protected"]=>
array(1) {
["max_id"]=>
int(4)
}
["_cleanData:protected"]=>
array(1) {
["max_id"]=>
int(4)
}
["_modifiedFields:protected"]=>
array(0) {
}
["_table:protected"]=>
object(Content)#126 (13) {
["_name:protected"]=>
string(7) "content"
["_primary:protected"]=>
array(1) {
[1]=>
string(10) "content_id"
}
["_db:protected"]=>
object(Zend_Db_Adapter_Mysqli)#37 (9) {
["_numericDataTypes:protected"]=>
array(16) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
["INT"]=>
int(0)
["INTEGER"]=>
int(0)
["MEDIUMINT"]=>
int(0)
["SMALLINT"]=>
int(0)
["TINYINT"]=>
int(0)
["BIGINT"]=>
int(1)
["SERIAL"]=>
int(1)
["DEC"]=>
int(2)
["DECIMAL"]=>
int(2)
["DOUBLE"]=>
int(2)
["DOUBLE PRECISION"]=>
int(2)
["FIXED"]=>
int(2)
["FLOAT"]=>
int(2)
}
["_stmt:protected"]=>
object(Zend_Db_Statement_Mysqli)#82 (12) {
["_stmt:protected"]=>
object(