What about a subquery in a lateral join then? Ah, it’s not necessary actually. What about this?
latest_video_analysis =
from va in VideoAnalysis,
where: va.video_id == ^video_id,
limit: 1,
order_by: [desc: :inserted_at]
from c in Clip,
join: va in subquery(latest_video_analysis),
where: c.video_analisis_id == va.id






















