[TYPO3-mvc] Aggregate Functions

Franz Koch typo3.RemoveForMessage at elements-net.de
Mon Jul 12 15:08:36 CEST 2010


Hey,

> How can I get values of aggregate functions using repository or else ?
> E.g. I need to find "SELECT AVG(clicks) FROM `tablename` WHERE pid = ?"

if you need special queries, don't hesitate to use raw SQL statements in 
your repository:

$query = $this->createQuery();

// if you need raw results and not objects, use the next line:
$query->getQueryConfiguration()->setReturnRawQueryResult(TRUE);

// now call your custom statement
return $query->statement('SELECT AVG(clicks) FROM `tablename` WHERE pid 
= ?')->execute();


-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list