Is this right?
select a.*,e.* from tablename a
join erid e on e.username=erid.username
where a.datetimecolumn=(select max(datetimecolumn) from tablename where username=a.username)
select a.*,e.* from tablename a
right join erid e on e.username=erid.username
where a.datetimecolumn=(select max(datetimecolumn) from tablename where username=a.username)
?
select a.*,b.* from tablename a
right join erid b on a.username=b.username
where a.datetimecolumn=(select max(datetimecolumn) from tablename where username=a.username)