better count sql statement on SELECT DISTINCT involked

fundawang - December 20, 2006 - 06:33
Project:Drupal
Version:7.x-dev
Component:other
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

If I involke pager_query() with 'SELECT DISTINCT u.uid FROM {users}', it will be replaced by 'SELECT count(*) FROM {users}' when counting users. Of course, it is just an example sql statement here. But the counting statement would be better be replaced to 'SELECT COUNT(DISTINCT(u.uid)) FROM {users}'.

Currently, the only way getting the wanted result is to passing extra $count parameters. But it would be better pager_query could do as following:
If 'SELECT DISTINCT' was found
$count_query = 'SELECT COUNT(DISTINCT(first_field))'...

#1

chx - December 20, 2006 - 10:27
Version:5.0-rc1» 6.x-dev
Component:page.module» other

features go against 6.x but my intentions are to replace count_query with a subselect. stay tuned.

#2

Pasqualle - September 16, 2008 - 03:20
Version:6.x-dev» 7.x-dev

fixed with dbtng?

 
 

Drupal is a registered trademark of Dries Buytaert.