FilteredRelation
code:python
>> qs = User.objects.annotate(
... checkin=FilteredRelation('checkin', condition=Q(checkin__date='2021-10-01', checkin__location__isnull=False))
... ).values('name', 'checkin__location')
>>
>> print(sqlparse.format(str(qs.query), reindent=True))
SELECT "users"."name",
checkin."location"
FROM "users"
LEFT OUTER JOIN "checkins" checkin ON ("users"."id" = checkin."user_id"
AND ((checkin."date" = 2021-10-01
AND checkin."location" IS NOT NULL)))
対象が N:1 関連の場合は、INNER JOIN になる
対象が 1:N 関連の場合は、LEFT OUTER JOIN になり行が増える