I log each time a user logs in to the database and on the home page show their last login date and time.
However, from the login page, I save the login details, so I don't want to show the most recent entry on the home page as that will be when they just logged in. I want to show the next most recent entry.
The tbl has:-
So, assuming I had:-Code:ID field autonumber userref field INT username field VARCHAR login_time DATETIME ip_address VARCHAR
The next time I login it will add another entry, say for 10:35. I then want to retrieve the 09:35 entry to show on the home page.Code:ID login_time 1 19/03/2009 08:35 2 19/03/2009 09:35
Is there an easy way to do this?
I'm thinking of something like SELECT TOP 2, but then I'm not sure how to get the 2nd entry.
Preferably want to do it using a Stored Proc.
Any ideas?



LinkBack URL
About LinkBacks
Reply With Quote



Bookmarks