Closed (duplicate)
Project:
Drupal core
Version:
7.x-dev
Component:
other
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Dec 2006 at 06:33 UTC
Updated:
27 May 2010 at 00:00 UTC
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))'...
Comments
Comment #1
chx commentedfeatures go against 6.x but my intentions are to replace count_query with a subselect. stay tuned.
Comment #2
pasquallefixed with dbtng?
Comment #3
berdirduplicate of #423888: Use subqueries for ->countQuery(), at least for MySQL
(Sorry for pinging the participants, I'm trying to clean up a few old
issues)