Calculate elapsed time

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
image

and the result would be something like this
image

hello

elapsed time compared to what point of time?

Hello!
to the current time

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