My SQL is very rusty so I don't remember how to do something basic. Trying to track and update the average gallons collected by each account, and days since most recent collection.
My first instinct was two sql calls, get all counts, get all collections, do the math and update the accounts. But that's n^2 and I feel like there's query syntax that can do that for me.
Also I am doing this stat update inside a dashlet report, which works tolerably enough, but wouldn't update on save of a new collection. Had the hack idea of making a custom formula that called the update function before save, but that seems not smart.
My first instinct was two sql calls, get all counts, get all collections, do the math and update the accounts. But that's n^2 and I feel like there's query syntax that can do that for me.
Also I am doing this stat update inside a dashlet report, which works tolerably enough, but wouldn't update on save of a new collection. Had the hack idea of making a custom formula that called the update function before save, but that seems not smart.

Comment