Last logged name

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have two tables with database logins:
tblEmployees: tblLogIn:
---------------- -----------
lngEmpID ----------- lngEmpID
strEmpName Date
strEmpPassword Time
strAccess ID (auto num.)
strGroup

How to find last strEmpName from table tblLogIn?
Last name is where is last ID number.
Thanks!
 
SELECT TblEmployees.*
FROM tblEmployees INNER JOIN tblLogin
ON tblemployees.lngEmpID = tblLogin.LngEmpID
WHERE tblLogin.ID = (SELECT Max(ID) FROM tblLogin)

That depends on the ID always increasing. Autonumbers don't necessarily do
that and they can even turn negative. You probably need to use the Date and
Time fields to identify the latest entry in tblLogin. Post back if you need
to do that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top