I have nodes (articles) in two categories set by two CCK fields (not taxonomy). I want to count the articles of a category. What I did was:
- Picked the three fields Node: Title, Content: Category and SQL Aggregation: Group By Fields.
- For Fields to Group On:, I picked Content: Category.
- For Fields to Aggregate with the SQL function, I picked Node: Title.
The result was that the Node: Title field content has been replaced with a number 1. I believe that is to be processed for counting. Next field shown is the Content: Category.
Problem is, the results were not counted and grouped. It returns all the published articles with the title replaced with the number 1. Is there anything I forgot to set?
View SQL generated:
SELECT node.nid AS nid,
COUNT(node_data_field_1_1.field_1_1_value) AS node_data_field_1_1_field_1_1_value,
node.type AS node_type,
node.vid AS node_vid,
node_data_field_1_1.field_1_3_value AS node_data_field_1_1_field_1_3_value
FROM node node
LEFT JOIN content_type_mp node_data_field_1_1 ON node.vid = node_data_field_1_1.vid
WHERE (node.status <> 0) AND (node.type in ('mp'))
GROUP BY node_data_field_1_1_field_1_3_value, nid, node_type, node_vid
ORDER BY node_data_field_1_1_field_1_1_value ASC
Returned result:
Title: 1
Category: Art
Title: 1
Category: Board usage
Title: 1
Category: Board usage
...
Comments
Comment #1
SanDiego CreditAttribution: SanDiego commentedI am also having the same problem. It does not group by, instead puts 1 instead of title.
Comment #2
amal850720 CreditAttribution: amal850720 commentedI would suggest you the following. I downgraded to rc1 and everything works well, with a few caveats:
I tried graphing the output using the latest version of Views Charts (1.0) and everything works fine out of the box.
I'm still trying to figure out what is going on behind the code in rc2 and the workarounds.
Comment #3
timlie CreditAttribution: timlie commentedWhich version of views are you using?
I have the same issues as the topic starter. Also with RC1.
Comment #4
amal850720 CreditAttribution: amal850720 commentedThe problem only occured to me when I was using rc2, not in rc1. Have you picked the correct fields?
Comment #5
timlie CreditAttribution: timlie commentedLike you described...
Comment #6
amal850720 CreditAttribution: amal850720 commentedNow that's weird. I'll take another look.
Comment #7
loophole080 CreditAttribution: loophole080 commentedsame thing with the column of "1"s in the agg field... downgraded to RC1 and works as expected
views 6.x-2.11, core 6.19
(very handy mod BTW thanks!)
Comment #8
peter.bod CreditAttribution: peter.bod commented2 works for me too
Comment #9
dasjoconfirming #2
Comment #10
quironHi all,
I have the same problem and with the DEV version dated 2011-Feb-25 works fine for me.
Comment #11
jvieille CreditAttribution: jvieille commentedMaybe you set a sort criteria : this kills the groupby clause