Opened 8 years ago

Last modified 8 years ago

#26696 closed Cleanup/optimization

QuerySet.extra: group by weekday on a date field — at Initial Version

Reported by: László Károlyi Owned by: nobody
Component: Database layer (models, ORM) Version: 1.9
Severity: Normal Keywords: day of week weekday
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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 seems impossible with even using the extra parameter.

Or is it?

Tips welcomed, but I actually given up on creating this query out of the ORM.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top