Calculate increase for this time from last time

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with 4 columes of CustomerID, Date_, Number_, reset_, and
having the following records,
1001;01/09/06;2;no
1001;15/09/06;3;no
1001;28/09/06;10;no
1001;01/10/06;30;no
1001;20/10/06;0;yes
1001;30/10/06;5;no
1001;02/11/06;15;no
1002;16/09/06;14;no
1002;16/10/06;44;no
1002;30/10/06;56;no
1002;01/11/06;70;no


I want to get the number of how much is increased for each customer each
month, I should get the following result:
1001;Sept/06;10
1001;Oct/06;25
1001;Nov/06;10
1002;Sept/06;14
1002;Oct/06;52
1002;Nov/06;14

How can I acheive this?

Thanks.
 
I do not get the same results that you did.

SELECT minnow.CustomerID, Format([Date_],"mmm yy") AS Month_,
Last([Number_])-First([Number_]) AS Difference
FROM minnow
GROUP BY minnow.CustomerID, Format([Date_],"mmm yy"), Format([Date_],"yyyymm")
ORDER BY minnow.CustomerID, Format([Date_],"yyyymm");

CustomerID Month_ Difference
1001 Sep 06 8
1001 Oct 06 -25
1001 Nov 06 0
1002 Sep 06 0
1002 Oct 06 12
1002 Nov 06 0
 
Back
Top