有登陆时间access_time 登录时间字段,数据类型为Date,最后在线时间化成分钟数,在线xxx分钟我的想法就是用sysdate减去登录时间字段,得出结果,但是语句报错(无效的月份),请大家指教,
select floor(sysdate - to_date(b.access_time,'yymmdd')) from dual,um_access_log b;
select floor(sysdate - to_date(b.access_time,'yymmdd')) from dual,um_access_log b;
select round((sysdate-access_time)*1440)
from um_access_log
select (sysdate-access_time)*24*60 from um_access_log where rownum<=1; ---得到分钟数
这个可以计算时间,但是好像不太算在线时间,因为作为用户,可能会把浏览器关掉的,那这样就不算是在线的啦?这该如何处理?
你的表应该也有LOGIN ,LOGOUT列吧
select round((sysdate-access_time)*1440)
from um_access_log