例如:表
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中文网2017-04-17 15:30:12
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;