Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
6.x-3.x-dev
Component:
Documentation
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2010 at 02:16 UTC
Updated:
1 Nov 2010 at 11:48 UTC
Hi,
Since there is no literature yet on this feature I wonder how do I choose fields for grouping. It says by the check-box "In All fields that are selected for grouping will be collapsed to one record per distinct value." Thats cool and I want that, but where do I choose grouping field?
I have 2 fields - name (text) and amount (number), both coming from cck 6.x-3.x-dev Multigroups (actual data below). Both have gear icon. I left default "Group results togather" for name and SUM for amount. It does not work, list is not changed.
Anna 5.00
Anna 2.00
Victor 0.50
Victor 10.00
i want
Anna 7.00
Victor 10.50
Comments
Comment #1
merlinofchaos commentedOnce you turn on grouping, to the right of the field there is a gear icon. Click that, and select SUM on the numeric field.
Note that there is a CCK patch linked in the release notes -- you'll need that to be able to successfully use this on CCK fields.
Comment #2
henrijs.seso commentedSorry to say it seems there is a bug. This is query views made and it does not work.
SOLUTION is to remove ", node_data_field_text_field_text_value_1" from last line, then it works (tested in phpmyadmin, pasted query there).
My view
Comment #3
dawehnerDid you applied the groupby-patch of cck?
Comment #4
henrijs.seso commentedNo, just installed 3-dev version. There is a pach? Ill look for it.
Comment #5
dawehnerOk, you don't read the release document: http://drupal.org/node/695302
Comment #6
henrijs.seso commentedFound patch here... http://drupal.org/node/695298. Reading release document...
Comment #7
henrijs.seso commentedMy bad, but still same problem.
I applied this patch http://drupal.org/node/670344 and other http://drupal.org/node/695298 was already committed in cck 3.x-dev.
Views query I get still has same problem - 2nd argument after GROUP BY should not be there...
Does not work:
Works:
Comment #8
thinkling commentedI'm having similar problems, I think. As soon as I add one aggregated field to my view, all the fields currently displayed get included in the GROUP BY clause of the query.
So for example, if I'm trying to tally how many posts each user has, I was pulling (Node:nid, User:name, Node:title) then turn on Grouping and change the nid field to be a COUNT, then I get:
How do I group only by users_name or users_uid but not by node_title?
(Edit: I have CCK 2.7 and the above-mentioned CCK patch for groupby installed.)
Comment #9
merlinofchaos commentedYou cannot. ANSI SQL rules require that if GROUP BY is used, then all fields in the SELECT portion of the query must either be 1) aggregate functions or 2) part of the GROUP BY.
Comment #10
un11imig commentedI have the same problem that #7. Any clue?
Comment #11
un11imig commentedI solved, as is stated here: http://drupal.org/node/903768
using
function mysitemodifications_views_query_alter(&$view, &$query) {
if ($view->name == 'view_name') {
unset($query->fields['node_data_field_field_name_name_name_1']);
}
}
on a custom module I use to define custom modification on my website.
I understand that it is a temporal solution while this bug is solved.
Regards,