Viewing 11 posts - 1 through 11 (of 11 total)
Thanks Chris for your solution, today I learned what DENSE_RANK() is! Quite a nifty function. 🙂
January 3, 2012 at 2:30 am
Glad to have been of help. I'm still not sure how quick the code will run on a large table, but if you run into issues with that we can...
December 30, 2011 at 4:46 am
Ok, I've found a solution that works for 3 consecutive months:
WITH cte_Payments AS (
SELECT ClaCaseID
, NameID
, IncidentDate
, YearID
, MonthID
, PaymentStatus
, ROW_NUMBER()OVER(PARTITION BY ClaCaseID, NameID, IncidentDate, PaymentStatus ORDER BY YearID, MonthID)...
December 30, 2011 at 3:59 am
Oh dear, I've just realised my solution doesn't cater for 3 consecutive months 🙁
I'll relook at it!
December 30, 2011 at 3:44 am
Ok, here's my solution, hope it helps (and that it produces the correct results 😉 )
WITH cte_Payments AS (
SELECT ClaCaseID
, NameID
, IncidentDate
, PaymentStatus = CASE WHEN PaymentStatus = 4 THEN...
December 30, 2011 at 3:38 am
I used the query below to view the data. You can tell based on the joins I've done if i've understood the rules correctly ( OR NOT! :-D)
SELECT ClaCaseID
, NameID
,...
December 30, 2011 at 3:09 am
Hi mic.con87
If i understand the rules you require then the result set you posted is incorrect for ClaCaseID 28584 and NameID 580627. If you consider the last DueDate for June...
December 30, 2011 at 2:53 am
Hi,
Can you give us more data to work with? I'm trying to build the query but I don't understand the full set of rules you require, it seems like you...
December 30, 2011 at 12:46 am
I think the correct term you're looking for is partitioning. Search for "sql server 2008 database partitioning" on Google and you will find the articles you're looking for. BTW, I've...
December 28, 2011 at 12:38 am
This is a great question, mostly because it got me searching and learning on the net... 🙂
This article is quite helpful: http://technet.microsoft.com/en-us/library/bb964719.aspx
I guess that if you have a SQL instance...
December 28, 2011 at 12:19 am
Hi Everyone,
Sorry for this, we found the problem, it is a ddl trigger.
Regards,
William :w00t:
December 23, 2011 at 12:25 am
Viewing 11 posts - 1 through 11 (of 11 total)