select * from 表名 group by name where dotime=(select max(dotime) from 表名)
标准答案 select name,max(dotime) dotime from tt group by name
其实这个还不是最终的答案,别忘了,仍旧要的是记录,而不是name 和 dotime, 没有dosomething应该是把这个查询作为子表,再关联源表进行查询:select ta.* from tt ta,( select name,max(dotime) dotime from tt group by name ) tb where ta.name=tb.name and ta.dotime=tb.dotime;
我很无语select * from tt where name,dotime in (select name,max(dotime) dotime from tt group by name0
select name,max(dotime) dotime from tt group by name
其实这个还不是最终的答案,别忘了,仍旧要的是记录,而不是name 和 dotime, 没有dosomething应该是把这个查询作为子表,再关联源表进行查询:select ta.* from tt ta,(
select name,max(dotime) dotime from tt group by name
) tb
where ta.name=tb.name and ta.dotime=tb.dotime;