[TYPO3-english] pi_list_query (pi_exec_query) does not take into account the groupby clause when count is enabled

Jochem Nabuurs jochem at roquin.nl
Mon Jul 12 15:37:21 CEST 2010


Hi list,

can anybody tell me why pi_list_query does not take into account the 
groupby clause when count is enabled. Is this a performance related 
design choice? I'm no mysql guru so I guess there is a good explaination.

The following code is used in class.tslib_pibase.php in the function 
pi_list_query:

if ($count) {
	$queryParts = array(
		'SELECT' => 'count(*)',
		'FROM' => $TABLENAMES,
		'WHERE' => $WHERE,
		'GROUPBY' => '',
		'ORDERBY' => '',
		'LIMIT' => ''
	);
} else {
	...

Group by is left empty...

The reason why I'm asking this is while I was playing with the 
dam_downloads extension I noticed duplicate records in the listView 
mode. This was caused by files having multiple DAM categories assigned. 
Therefore they where displayed for each category assigned to the file.
The extension uses pi_exec_query to list results, but does it incorrect, 
according to my findings.

Kind regards,


Jochem Nabuurs

ROQUIN E-Solutions
The Netherlands


More information about the TYPO3-english mailing list