Re: [sqlite] Break on cumulative sum

2013-03-03 Thread James K. Lowden
On Sat, 2 Mar 2013 14:46:40 +0100 Gert Van Assche wrote: > All, I don't know how to achieve this: I need to put the cumulative > sum in a field, and create a group as soon as that cumulative sum is > over a breakpoint value (10). This was a bit of a challenge because the

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread Gert Van Assche
James, I'm very impressed by your solution. My SQL knowledge is not yet good enough to understand what you proposed, but I hope one day that I will be able to understand and replicate myself the code you wrote. I started of with a join on the table itself as well, but I got stuck. I'll study your

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread James K. Lowden
On Sun, 3 Mar 2013 11:46:26 +0100 Gert Van Assche wrote: > My SQL knowledge is not yet good enough to understand what you > proposed, but I hope one day that I will be able to understand and > replicate myself the code you wrote. I started of with a join on the > table

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread Michael Black
One thing I'll point out...the trigger solution is almost linear performance and constant memory where the single SQL statement will suffer notably as time goes on in both those measures. Also the single SQL statement doesn't seem like a good idea if the data is coming in real time. He never

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread Petite Abeille
On Mar 3, 2013, at 2:10 PM, "James K. Lowden" wrote: > There's some cruft, too. I was only demonstrating that it could be > done. If you find a way to simplify it, you'll know you understand > it. Ah… if only… SQLite had analytical functions… oh, well..

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread James K. Lowden
On Sun, 3 Mar 2013 18:50:35 +0100 Petite Abeille wrote: > Ah? if only? SQLite had analytical functions? oh, well.. What do you have in mind? I've benn adding some user defined functions and am thinking of creating a repository for them. --jkl

Re: [sqlite] Break on cumulative sum

2013-03-03 Thread James K. Lowden
On Sun, 3 Mar 2013 07:19:11 -0600 "Michael Black" wrote: > One thing I'll point out...the trigger solution is almost linear > performance and constant memory where the single SQL statement will > suffer notably as time goes on in both those measures. Also the > single SQL