I've got this query
SELECT t.id,t.title,count(k.id) as likes
FROM topics t
LEFT JOIN topic_like k on t.id = k.topic_id
group by t.id, t.title
ORDER BY likes desc ;
When I try to convert it to the JPQL, I do it like this but I gut some issues
@Query("SELECT p,count(k.id) as likes FROM TopicJpa p " +
"LEFT JOIN TopicLikeJpa k " +
"GROUP BY p ORDER BY COUNT(likes)")
Page<TopicJpa> getAllTopicsWithLikeCountsSort(Pageable pageable);