January 14, 2010 at 5:33 pm
Hello everyone I am trying to get a list of names that have a balance of $5.00 or less for the last 30 consecutive days, this is what came up with,however I am not getting consecutive days results.
I need to see only people that have a $5.00 balance at the end of a 30 day period
with no transactions taking place other than the $5.00 balance .
not sure how to proceed at this point, thank you for taking the time to read / help
declare @StartDate datetime
set @StartDate = dateadd(day,-30, datediff(day,0,getdate()))
select First_Name,Last_Name,balance
from inbalance
where balance <= 5.00 and TransActiondate >= @StartDate
January 14, 2010 at 8:51 pm
Since you're brand spanking new to the forum, I recommend you read the following... people will be a lot more willing to help if you help them help you.
http://www.sqlservercentral.com/articles/Best+Practices/61537/
--Jeff Moden
Change is inevitable... Change for the better is not.
January 15, 2010 at 1:27 am
Heres one method of processing contiguous data issues
http://sqlblogcasts.com/blogs/sqlandthelike/archive/2009/08/27/sql-and-contiguous-data-ranges.aspx
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply