dstjohnjr
asked on
Date query for report to find active / inactive users logging in within last 6 months
I have a DotNet site that I am creating some reports for with SQL Reporting Services 2005 and I need to build a query that will show me the following:
1. Active Users (logging into site within last 6 months)
2. Inactive Users (have not logged into site within last 6 months)
This is from the standard aspnet_Users log table. The date field to query is called "LastActivityDate".
TIA for any expert knowledge!
1. Active Users (logging into site within last 6 months)
2. Inactive Users (have not logged into site within last 6 months)
This is from the standard aspnet_Users log table. The date field to query is called "LastActivityDate".
TIA for any expert knowledge!
ASKER
Hmmm.... That doesn't appear to be it.
select * from aspnet_Users
where DateAdd(m, -6, getdate() <= LastActivityDate)
First off, I needed to add a closing paren.
Next, I'm getting this error:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '<'.
Is that the right operator for Less than or equal to?
Thanks for your help!
select * from aspnet_Users
where DateAdd(m, -6, getdate() <= LastActivityDate)
First off, I needed to add a closing paren.
Next, I'm getting this error:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '<'.
Is that the right operator for Less than or equal to?
Thanks for your help!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry this is so late. Thanks for the excellent expert help!
select * from aspnet_Users
where DateAdd(m, -6, getdate() <= LastActivityDate
InActive:
select * from aspnet_Users
where DateAdd(m, -6, getdate() > LastActivityDate