I created a view and want to count and sum a column, and in both cases it doubled the count. It works fine for user1, but other users see double counts.

Comments

karens’s picture

I assume you are using some sort of node access. This is a core bug, see #681760: Try to improve performance and eliminate duplicates caused by node_access table joins.

I'm going to leave this active, but that is the source of the problem, not Views Calc.

danny englander’s picture

I appear to be having the same issue. I am using CCK's content access so would this be causing the doubling of count in my case as well? Thanks.

karens’s picture

Any kind of access control runs the query through db_rewrite_sql, which causes the problem.

They are now trying to fix it in the D7 version, there is no telling how long it will be before it gets fixed in D6. Note the patch at http://drupal.org/node/681760#comment-3155816. I found that making that patch fixed the problem for me, so you could just make a patch in the meantime if you need to get past this.

danny englander’s picture

Karen, thanks I will check that out. I found a very low tech way of getting a count here:

http://drupal.org/node/534714#comment-3736358

... which seems to do the trick and I can put in the footer of the view. cheers, thanks.

miro_dietiker’s picture

Title: Doubles count and sum for everyone but user1 » Node access (db_rewrite_sql) causes double (n-times) results for everyone but uid=1

Renaming to allow better search match.

alfthecat’s picture

subscribing

newtoid’s picture

+1 subscribing :^)

obrienmd’s picture

Subscribing, patch noted in #3 works for me, but does anyone know if this can be fixed in a views_query_alter instead? I hate to hack core.

eclauset’s picture

I am seeing the same issue (views calc sum is doubled) but for all users. I am not using any content access modules. The patch linked above does not change the result.

karens’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

The D6 version is no longer supported.