取分组中 第一条数据
方法1:select h1.id, h1.updatetime
from htmlmanager h1
where not exists (select * from htmlmanager h2 where h1.id=h2.id and h1.updatetime<h2.updatetime);
from htmlmanager h1
where not exists (select * from htmlmanager h2 where h1.id=h2.id and h1.updatetime<h2.updatetime);
方法2:
select h1.id, h1.updatetime
from htmlmanager h1
where h1.updatetime = (select max(h2.updatetime) from htmlmanager h2 where h1.id=h2.id);
from htmlmanager h1
where h1.updatetime = (select max(h2.updatetime) from htmlmanager h2 where h1.id=h2.id);