I have the following query:
export_date_query = RecordExport.objects.filter(record=OuterRef("id")).order_by("-id").values("export__created_at")[:1]
return Record.objects.annotate(export_date=Subquery(export_date_query))
However, I would like to change it so that I return the latest TWO, but I get the error: "more than one row returned by a subquery used as an expression". Is there a straightforward way to achieve this? Thanks!