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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Count Consecutive Days 1

Status
Not open for further replies.

IAMINFO

MIS
Feb 21, 2002
62
US
Hello everyone I am learning sql and I am not sure how to
proceed.

I need to get a list of names that have a balance of 5.00 or less for the last 30 consecutive days.

Please help or guide me to an example
I might study. Thank you very much for taking the time


select First_Name,Last_Name,balance
from imbalance
where balance <= 5.00

 
Take a look at this thread183-1575641
Code:
declare @StartDate datetime

set @StartDate = dateadd(day,-30, datediff(day,0,getdate()))

select First_Name,Last_Name,balancefrom imbalancewhere balance <= 5.00 and DateField >=@StartDate
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top