Database structure
Table 'Org_f_a_list'
id org_id user_id date_added
1 1 1 2017-01-01 05:05:05
Table 'Users'
id username last_login
1 Testuser 2017-01-01 05:05:05
Table 'Users_pa'
id user_id summoner_id rank_solo
1 1 1 15
2 1 2 17
My current query
select max(rank_solo) as rank,last_login,username,o.user_id,date_added
from org_f_a_list o
join users u on o.user_id = u.id
join users_pa as p on u.id = p.user_id
where org_id = :org
group by u.id,rank_solo,date_added
order by rank desc
What I want the result to be
user_id user_name rank date_added last_login
1 Testuser 17 date date
My current result
user_id user_name rank date_added last_login
1 Testuser 15 date date
1 Testuser 17 date date
For some reason the group by u.id is not doing anything and I still pull both rows and not just the max rank
Edit : That fixed it. Thanks guys!