[TYPO3-mvc] Help needed for DISTINCT using QOM

Fabien Udriot fudriot at omic.ch
Thu Apr 21 16:52:31 CEST 2011


Found a solution with:

$query->getQuerySettings()->setReturnRawQueryResult(TRUE);


Complete code snippet is here:

public function findAllCountries() {
	$query = $this->createQuery();
	$query->getQuerySettings()->setReturnRawQueryResult(TRUE);
	$query->statement('SELECT DISTINCT country FROM tx_typo3agencies_domain_model_agency);
	$result = $query->execute();
	return $result;
}



On 4/21/11 6:32 PM, Fabien Udriot wrote:
> Hi all,
>
> Would you have any idea / hint how to do a DISTINCT with extbase 1.3 using the QOM. I didn't find
> any clue neither on the ML nor on the Internet. My goal would be to retrieve all DISTINCT countries
> from a set of records. Don't know what would be the best approach.
>
> With extbase 1.2, we could do the code above. However $query->statement does not seem to work well
> with extbase 1.3. Basically, when I loop in the template, it appears to be the same record at every
> loop.
>
> public function findAllCountries() {
> $query = $this->createQuery();
> $query->statement('SELECT DISTINCT country FROM tx_typo3agencies_domain_model_agency');
> return $query->execute();
> }
>
> Thanks for help as the problem is quiet urgent for me.
>
> Fb.


More information about the TYPO3-project-typo3v4mvc mailing list