# django__django-15320
# Loki Mode Multi-Agent Patch
# Attempts: 1

--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -1110,6 +1110,7 @@ class Subquery(BaseExpression, Combinable):
     def __init__(self, queryset, output_field=None, **extra):
         # Allow the usage of both QuerySet and sql.Query objects.
         self.query = getattr(queryset, 'query', queryset).clone()
+        self.query.subquery = True
         self.extra = extra
         super().__init__(output_field)