Opened 9 years ago
Last modified 9 years ago
#26696 closed Cleanup/optimization
QuerySet.extra: group by weekday on a date field — at Version 1
Description (last modified by ) ¶
Hey,
I'm coming from the Django doc, where you say that I should try to avoid using QuerySet.extra
in the future, and report the thing I want to achieve here, so you could improve the ORM. Here's the thing:
I have a mysql table where there is a date
field. I'd like to do a DAYOFWEEK(date)
calculation on it, then GROUP BY
its result, and then do some MIN
/MAX
/AVG
calculation on another field in the table. The point is to get the minimum/maximum/average values for the days of the week.
Currently this does not seem possible with even using the extra parameter.
Or is it?
Tips welcomed, but I actually have given up on creating this query out of the ORM.