Home >Backend Development >PHP Tutorial >How to get the latest value from multiple IDs in a joint query in mysql?
For example, take a record of the user’s highest score
user table
id name
1 aaa
2 bbb
3 ccc
Score table
uid score
1 10
1 32
1 88
2 21
2 4
3 93
3 70
user.id = s.uid
How to get the user’s highest score record using a joint table
Thank you in advance
For example, get a record of the user’s highest score
user table
id name
1 aaa
2 bbb
3 ccc
Score table
uid score
1 10
1 32
1 88
2 21
2 4
3 93
3 70
user.id = s.uid
How to get the user’s highest score record using a joint table
Thank you in advance
select user.name, user.id, max(s.score) from s inner join user.id = s.uid group by s.uid