Hello All,
DB platform: SQL Server 2005
I'm trying to create a daily data pull to check for User that have not login to the system for 48 hours.
the query below is working fine for Tuesday - Friday run. However, on Monday, I need the logic to exclude
Saturday and Sunday hours. For example, if the report run on Monday, 12/8 8am, I want the users that have not
login in since Friday, 12/5 8am. The users are not required to login during the weekend.
select UserName,max(AccessedDate) as LastLogin
into #t1
from tblLogin
group by UserName
select UserName,LastLogin
from #t1
where UserName NOT IN (select UserName from #t1
where LastLogin >= DATEADD(hour, -48, GETDATE())
Your input/sugesstion is greatly appreciated
Thanks
DB platform: SQL Server 2005
I'm trying to create a daily data pull to check for User that have not login to the system for 48 hours.
the query below is working fine for Tuesday - Friday run. However, on Monday, I need the logic to exclude
Saturday and Sunday hours. For example, if the report run on Monday, 12/8 8am, I want the users that have not
login in since Friday, 12/5 8am. The users are not required to login during the weekend.
select UserName,max(AccessedDate) as LastLogin
into #t1
from tblLogin
group by UserName
select UserName,LastLogin
from #t1
where UserName NOT IN (select UserName from #t1
where LastLogin >= DATEADD(hour, -48, GETDATE())
Your input/sugesstion is greatly appreciated
Thanks