Using Django Window Functions on a Filtered QuerySet

45 views
Skip to first unread message

Bernd Wechner

unread,
Jan 28, 2019, 7:01:56 PM1/28/19
to Django users
I have a filtered queryset, and annotated it with a few window functions. I got a most surprising result when the filter is on fields in a related model and it turns out this lies in the structure of the SQL.

I asked the question here:


mainly because it supports nice layout and captures responses in nice way. The issue is explained there in some detail.

I have in the interim found a work around to meet my needs using slightly different query again, but am still puzzled about this question as it seems fairly prosaic and normal issue, the need to SELECT not from a TABLE but the result of another SELECT. Subqueries speak a little to this but not in a general way that I can seem to manipulate to produce the desired query (the third on cited on the stackoverflow question).

Regards,

Bernd.

Bernd Wechner

unread,
Feb 26, 2019, 10:17:53 PM2/26/19
to Django users
Stunning silence on this all round ... Hmmm
Reply all
Reply to author
Forward
0 new messages