select id,max(regtime) regtime from tablename where ..
group by id