How to get correct SUM() when joining table with duplicated row data?

Currently I have 3 tables, the first table ‘Users’ contains id and user_name. The second table ‘listings’ contains refno and agent_id. And my third table ‘logs’ contains refno and status. Now I want to display the name of a person next to their status. So basically I want the count of status entries from logs and put their respective username next to it.