當用戶登錄到我的應用程序時,該行被插入到登錄日誌表中。我想要在用戶登錄系統時打印上次登錄時間。我怎樣才能獲得最後登錄時間?如何獲取使用時間插入的第二行?
我試過max(time)
,但它給了我當前的登錄時間,但我想要以前。我怎樣才能得到這個?
這裏是我的查詢:
select login_time
from tblname
where emp_code = 123
and login_time = (select max(LOGIN_TIME)
from tblname
where emp_code = 123)
請標記正確的DBMS。它是MySQL,Oracle還是SQL Server? –
好的,編輯:) :) –
類似於:select max(login_time)from ... where login_time
jarlh