James
08/12/2021, 5:20 PMSELECT
p.*, ROUND(AVG(rt.rating), 1) AS user_rating
FROM
posts AS p
LEFT JOIN
ratings AS rt ON rt.entry_id = p.id
GROUP BY p.id;
I found the docs for aggregations & counts, but it doesn't seem to do what I need (I think). Do I need to create a new model to accomplish joins / selects from other tables?
I did post on stack overflow earlier if slightly more context would help. Also, if there is a more appropriate place to ask newbie questions in please let me know 🙂Victor Iris
08/12/2021, 5:34 PMJames
08/12/2021, 5:36 PMVictor Iris
08/12/2021, 7:01 PMJames
08/12/2021, 7:02 PM