Can someone from EdgeDB explain why the SQL isn't as simple as what I have below? What am I missing? Why is that cross join lateral necessary:
SELECT
title,
ARRAY_SLICE(ARRAY_AGG(movie_actors.name WITHIN GROUP (order by movie_actors.credits_order asc)),0,5)
avg(movie_reviews.score)
FROM movie
JOIN movie_actors on (movie.id = movie_actors.movie_id)
JOIN person on (movie_Actors.person_id = person.id)
JOIN movie_reviews on (movie.id = movie_reviews.id)
WHERE person.name like '%Zendaya%'
group by title
Also, this query is wrong because we want movies where Zendaya played, but _also_ other actors in order, possibly without Zendaya, so you really need to do the actors join twice.
Comments (323) 88 threads
Show all comments
Showing thread 17 of 88
Continue this thread — 1 reply