Raw mysql populate relations

hello, i need to use the mysql group by to find the id of duplicate records on the db, unfortunatelly i have to use the raw command because i can not find a way to use the group by with the entityservice my basic query is this:
let [res] = await strapi.db.connection.raw(SELECT id from leads group by Name having count(id) > 1;)
now i need to add another field (to find only the records that have the same Name and City) but the City field is a relation with the city table, what kind on join or think i have to do to be able to achieve this?

thanks

This topic has been created from a Discord post (1245680784493379644) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord