April 23, 2010 at 8:46 am
Hi,
I have 2 similar tables, like these:
Create Table Report(Month int, Value float)
Create Table ReportCorrect(Month int, Value float)
with these values:
Insert Report values(1,16),(2,11),(3,12),(4,15),(5,0),(6,34),(7,56),(8,14),(9,24),(10,0),(11,12),(12,14)
Go
Insert ReportCorrect values(1,16),(2,11),(3,12),(4,15),(5,11),(6,34),(7,56),(8,14),(9,24),(10,31),(11,12),(12,14)
In the Report table, for the months 5 (May) and 10 (October), I have Value=0.
Now I have to insert this gap (11 and 31) in another table (with the same structure), only if the following month has not zero value. If has zero value, I have to sum these values and put in the following month, and so on.
In this case I should obtain
Month - Value
6 - 11
11 - 31
How can I solve this particular problem?
(I have to use only SQL Server 2000 features)
Thanks a lot.
Luigi
April 23, 2010 at 8:56 am
I'm sorry, Luigi, I don't understand where values 11-31 come from.
Can you explain it in other words please?
I guess you're Italian: I don't think we will be reprimanded for a couple of posts in our native speech...
-- Gianluca Sartori
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply