Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query - determine no activity

Status
Not open for further replies.

jasonhuibers

Programmer
Sep 12, 2005
290
CA
Columns:

Buy_Date (Activity date)
Activity_Flag (1=there was activity)


How can I query my sql database for non actvity for 1 month, 3 month and 6 months?

 
For 30 days:

select *
from yourtable
where dateadd ("d", buy_date, 30) < date
and activity_flag <> 1

If a 1 is only written in when activity takes place, you need to change "<> 1" to "is null"

For the other date periods, change the number in the DateAdd line.

John

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top