MySQL Forums
Forum List  »  InnoDB

Re: Accumulated Sum
Posted by: Larry Regencia
Date: June 26, 2005 10:07PM

Jay,

Thanks for the idea but the results is not the one that we really up to. Let me just change the scenario, is it possible if it would look like this:

Date Code StockCode IN Sum
--------------------------------------------------------------------------------------
2005-06-24 12:23:06 206 StockA 5.00 5.0
2005-06-24 12:23:06 207 StockA 5.00 10.0
2005-06-24 12:30:07 211 StockA 200.00 215.0
2005-06-24 12:30:45 213 StockA 200.00 415.0
2005-06-24 12:32:48 214 StockA 5.00 420.0
2005-06-24 12:32:50 215 StockA 5.00 425.0

You idea works if we are going to Join them ON date and with the assumption that you have earlier, but this time I have to join it by Code and group them by StockCode. I did a query but the results are no good. I believe we are pretty close to it already, but the results need to be refine.

Have you tried creating functions that is similar to Postgres, i think accumulated sum is really easy if create UDFs.

Regards,

Larry Vincent

Options: ReplyQuote


Subject
Views
Written By
Posted
7586
June 26, 2005 07:36AM
3420
June 26, 2005 07:48AM
Re: Accumulated Sum
3788
June 26, 2005 10:07PM
3506
June 26, 2005 11:16PM
2923
June 27, 2005 12:32AM
2679
June 27, 2005 01:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.