James Murrell
asked on
each month
bit brain dead today, i have this code, how can i make it automatically do previous month at the mo i have to enter manually....
select count(*) as times,member_id,licensed,used
from user_count
where used > licensed+1 and dt_stamp between '2007-02-01' and '2007-02-28'
group by member_id,licensed,used
order by member_id, used
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
from user_count
where used > licensed+1 and dt_stamp between dateadd(m, -1, getdate()) and gettdate()
group by member_id,licensed,used
order by member_id, used