```sql select * from ttt as a left join( select max(time) as m, bizNo_key from ttt group by bizNo_key ) as b on (a.bizNo_key = b.bizNo_key and a.time = b.m); ``` 多试试
SELECT id,context,MAX(time),bizNo,bizNo_Key FROM table_name GOURP BY bizNo_Key
vindac
2020-04-18 16:12:24 +08:00
SELECT * FROM( SELECT id, @rank := IF (@perNO = bizNo_Key, @rank + 1, 1) AS rank, @perNO = bizNo_Key FROM tbl ORDER BY bizNo_Key, time DESC) t WHERE t.rank = 1