mysql - 如何查询一张表中各个用户优先级最高的模板
伊谢尔伦
伊谢尔伦 2017-04-17 15:28:12
0
2
628

例如:表
user temp rank
u1 a 2
u1 b 0.5
u1 c 3
u2 aa 1.7
u2 cc 3
u3 dd 2
我希望拿到u1,b

     u2,aa
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
洪涛

Suppose your table name is test:

select a.user, a.temp from test a left join test b on a.user = b.user and a.rank > b.rank where b.rank is NULL;
阿神

The one upstairs is the correct answer.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!