I’m developing some code, that needs to execute this query
(Traditional MYSQL)
SELECT * FROM `SistemaPuntuacions` WHERE `rankingActual` BETWEEN (SELECT `rankingActual` FROM `SistemaPuntuacions` WHERE `user_id` = $id) -5 AND (SELECT `rankingActual` FROM `SistemaPuntuacions` WHERE `user_id` = $id) +5 ORDER BY `rankingActual`"
Basically I’ve in SistemaPuntuacions a list of users, with their ranking (rankingActual). I need to show the 5 users above this users ranking and the 5 below.
But there’s no “BETWEEN” in doctrine language, so I’m stuck there.
Can I get some help?
Thank you.
Well, actually there is a BETWEEN in DQL. This code snippet is from the official docs.