I read and tried every post I could find, also tried to add the patch from http://drupal.org/node/695298#comment-4905348 but I'm still at a dead end.
I'm using
Drupal 6.22
Views 6.x-3.0-alpha3
CCK 6.x-2.9
I set up a Content Type (Entry) with several fields, among them one (Number) is an integer and another one (Type) is a varchar
I made a View with
Style: Table
Use Grouping: Yes
Fields: Number (SUM), Type
Filter: Type is "Entry"
I was hoping for a single row for each distinct Type with Number being the sum of all the rows but I still get all the rows distinct
In the query i can see there are node_type, nid, node_vid, node_created in the Group By statement and no matter what I do I always get them, what I'm doing wrong?
Comments
Comment #1
dawehnerPlease fill out the data probably. You currently saying it.s 2.9 even you are using the views groupby feature.
Comment #2
keyiyek CreditAttribution: keyiyek commentedSorry, my mistake, after two days applying avery patch to CCK 2.9 I lost track of what I was actually doing...
still the problem remains
Comment #3
dawehnerNid shouldn't be part of the query. Could it be that some of the fields are linked to it's node?
Comment #4
keyiyek CreditAttribution: keyiyek commentedok, I get rid of the nid and date,
date was coming from the sorting setting (nid I don't know but is gone)
manually applied the patch from the post quoted in #1
but still have issues
I have only
2 fields set: Content:Number and Content:Type
1 Filter: Node:Type
I set Content:Number as SUM but I see that in the query the Group By statement has both Content:Number and Content:Type, so the Number is summed only if both Type and Number are the same
Comment #5
dawehnerIn general you can have something either in the groupby part of the query or be part of an aggregation function like SUM or COUNT.
To be able to use it please update to the 6.x-3.x-dev and to the latest cck version as well, older versions aren't supported because they are old :)
Comment #6
keyiyek CreditAttribution: keyiyek commentedthanks for the time you are taking to answer me but I still can't make it working.
I updated everything to the latest revision. For what I understand from this post http://drupal.org/node/695298
a patch to cck must be applied, did that also.
Now if I set something like picture 01
the resulting query is
as you see I still get in the group by the field I am summing on, this means I can sum rows where the number is the same
Comment #7
dawehnerMh you might have to update to 6.x-3.x-dev as well.
Please try to use the dev version of views and somehow latest with the patch of cck. This should really work from my perspective.
Comment #8
keyiyek CreditAttribution: keyiyek commentedstill no luck
I still have a field both in the SUM and the GROUP BY statement
is there any way I can manually change the query? Not a perfect solution, but good enough to make me able to deliver the final product
Comment #9
keyiyek CreditAttribution: keyiyek commentedSome news on this issue
I was following step by step the code to understand what was going on and I stepped into something I don't understand
this is the query up to now
a "node_data_field_ball_num_field_ball_num_value_1" is present that actually should not exist.
It is created by the following line
in view.inc file
this line is run for each field: nid, tipo, luogo, ball_num. Every other field returns a single object placed in query[fields], but ball_num, that returns 2 objects ball_num and ball_num_1.
I'm pretty sure that is the problem, since ball_num_1 should be not there.
Anyone with some sugestions
Comment #10
keyiyek CreditAttribution: keyiyek commentedok, found out what the problem was and found a fix
I went deeper in the code and found out the alias_01 was created in
views_plugin_query_default.inc
around the end of functionadd_field
(about line 700). The problem was that the function is called twice for each field (don't ask me why), and in the said function there is a check whether the second time the field is the same, but according to the$field_info
variable the second time there is no reference to the aggregation function so the fields are seen as different and the alias_01 pops out.thanks to an hint here http://drupal.org/node/695298#comment-4917872, which at first I supposed not relevant, I applied the patch here
http://drupal.org/node/1073350#comment-4350016 and now things seem to work smoothly.
In the end I'm working with CCK 6.x-2.8 and Views 6.x-3.x-dev
Comment #11
dawehnerIf you found a solution to an issue feel free to mark the issue as fixed next time.
Comment #12
keyiyek CreditAttribution: keyiyek commentedSorry, changed the title forgot to change the status