Hello!
I'm trying to get an sql where I can see the elapsed time(Hours, minutes) for a user that hasn't done any activity. Any suggestions?
I have the following tables
Table test, datareg = the time for the latest activity by a user
and the result would be something like this
hello
elapsed time compared to what point of time?
1 Like
Hello!
to the current time
1 Like
always provide data sample not as an image but as proper DDL and DML
declare @kriss table(loguser varchar(50), datreg datetime)
insert into @kriss
select 'Darth Vader', '2022-10-13 15:43:12'
select loguser , datediff(mi, getdate(),datreg) from @kriss
make sure to read this through
getdate() is the current date and time
select
logguser
, datediff(minute,datreg,getdate()) as inactivity
from
Test