Re: ORM - Subquery / Window

2018-06-07 Thread marco . nicotra
As suggested i'm writing what i've already tried: Raw SQL using the query written in the first message, selecting only the id field and passing it to the ORM as id__in=ids. Slow as hell, unusable. Declared a WIndow function to use as filter: Article.objects.annotate(max_rev=Window(expression=Ma

ORM - Subquery / Window

2018-06-07 Thread marco . nicotra
Hello everyone, i want to extract the records with Max("revision") from a table like this: pn1rev1description pn1rev2description pn2rev1anotherdescription pn1rev3description pn2rev2anotherdescription The first column is a part number, the second is its rev