Good afternoon, I'm making an app where I need to list all rooms of a user and the last recorded consumption of each room, except that my code searches wrong, if a room has more than one consumption it doubles the same , so I would like some help to sort out my sql command. Here are how-to prints for more than one use per room:
The code I'm using:
SELECT co.id,co.descricao,ca.potencia_atual from comodo co INNER JOIN consumo_atual ca ON ca.Comodo_id = co.id WHERE co.Usuario_id = :id