Hello,
what could be the problem when from this code :

    reputation = Repute.objects.extra(
        select={'positive': 'sum(positive)', 'negative': 'sum
(negative)', 'question_id':'question_id',
            'title': 'question.title'},
        tables=['repute', 'question'],
        order_by=['-reputed_at'],
        where=['user_id=%s AND question_id=question.id'],
        params=[user.id]
    ).values('positive', 'negative', 'question_id', 'title',
'reputed_at', 'reputation')
    reputation.query.group_by = ['question_id']

this SQL query is generated :

SELECT (sum(positive)) AS `positive`, (question.title) AS `title`, (sum
(negative)) AS `negative`, (question_id) AS `question_id`,
`repute`.`reputed_at`, `repute`.`reputation`
FROM `repute` , `question`
WHERE user_id=1 AND question_id=question.id
GROUP BY question_id, sum(positive), question.title, sum(negative),
question_id
ORDER BY `repute`.`reputed_at`
DESC LIMIT 21

I think there are too much GROUP BY columns. It should be only "GROUP
BY question_id". I get the error "Caught an exception while rendering:
(1111, 'Invalid use of group function')".

Peter

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to