我仍然有选择 date_of_highest_points 的问题:
$qry1 = mysql_query("INSERT INTO bbdnes_hraci (nick, sumfrags, sumpoints,
sumhours, lastdate1, highest_points, date_of_highest_points)
SELECT DISTINCT nick, SUM(frags), SUM(points), SUM(hours),
MAX(lastdate), MAX(points), ??????
FROM hraci
GROUP BY nick ");
我在这里问过这个问题https://stackoverflow.com/questions/18817900/select-in-select,但我没有解决它,尽管有理事会。有人可以帮我写代码吗?
表:hraci
nick frags points hours lastdate
Gamer1 20 100 1 2013-09-17 22:16:08
Gamer1 30 150 3 2013-09-18 20:17:15
Gamer1 25 125 0.5 2013-09-18 23:16:06
Gamer2 50 250 4 2013-09-17 21:11:30
Gamer2 5 25 2 2013-09-17 23:13:59
需要得到:
表:bbdnes_hrici
nick sumfrags sumpoints sumhours lastdate1 highest_points date_of_highest_points
Gamer1 75 375 4.5 2013-09-18 23:16:06 150 2013-09-18 20:17:15 ??
Gamer2 55 275 6 2013-09-17 23:13:59 250 2013-09-17 21:11:30 ??