我的数据库中有以下数据
|NO | name |exp | mod_date |
+---+-------+------+-------------------+
|1 | dede | 1 |2012-11-07 01:04:26|
|2 | dede | 10 |2012-11-07 01:05:42|
|3 | GoGo | 20 |2012-11-07 03:05:40|
|4 | baba | 23 |2012-11-07 05:22:50|
|5 | baba | 35 |2012-11-07 08:06:57|
|6 | baba | 50 |2012-11-08 06:32:13|
|7 | rara | 43 |2012-11-13 06:40:35|
我想获取每个名称的最后更新 mod_date :
|NO | name |exp | mod_date |
+---+-------+------+-------------------+
|2 | dede | 10 |2012-11-07 01:04:26|
|3 | GoGo | 20 |2012-11-07 03:05:40|
|6 | baba | 50 |2012-11-08 06:32:13|
|7 | rara | 43 |2012-11-13 06:40:35|
我尝试了这个解决方案,但它没有用(同样的问题)
SELECT no,name,exp,max(date) FROM skill_exp
GROUP BY name
我从那个查询中得到这个结果
|NO | name |exp | mod_date |
+---+-------+------+-------------------+
|1 | dede | 1 |2012-11-07 01:05:42|
|3 | GoGo | 20 |2012-11-07 03:05:40|
|4 | baba | 23 |2012-11-07 05:22:50|
|7 | rara | 43 |2012-11-13 06:40:35|