SELECT taskId, name
FROM tasks
WHERE taskId = (SELECT MAX(taskId) FROM tasks);
кроме такого варианта :)
public function getLastTaskForId($data)
{
$select = Zend_Db_Table::getDefaultAdapter()->query(
"SELECT taskId, name 't.name'
FROM tasks
WHERE categoryId = $data and taskId = (SELECT max(taskId) FROM tasks WHERE categoryId = $data)")->fetchAll();
return $select[0];
}