Can the django ORM do something like this? SELECT * FROM "products_maxbid" as m JOIN "products_auction" as a on m.auction_id = a.uuid WHERE m.uuid in ( SELECT m.uuid FROM "products_maxbid" as m INNER JOIN ( SELECT auction_id, Max(value) as value FROM "products_maxbid" WHERE user_id = '2' GROUP BY auction_id) n on m.auction_id = n.auction_id and m.value = n.value and m.user_id = '2') ORDER BY a.square_id
SO question - https://stackoverflow.com/questions/60789513/django-query-for-max-value-for-column-which-includes-foreign-key-table-also-in-r -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJXS7_MePOU_LYhVWLKsG0gz4XyVdDS8w4LhpFyYCQpQVUGkOw%40mail.gmail.com.