So this is a database schema issue. Typically what you will want to do with things like balances is to store the balance in a column as each value in the equation changes. You are asking your SQL server to do all the calculations for all your records all at once. If SLQ only has to calculate when insert/update is performed, you wouldn’t notice. Better yet, do the calculations in Livecode and store the result in the database column. WAAAAY quicker.
Bob S On Apr 1, 2020, at 12:13 PM, Terence Heaford via use-livecode <use-livecode@lists.runrev.com<mailto:use-livecode@lists.runrev.com>> wrote: This actually works but is very slow (> 800ms) put merge("SELECT *,SUM (amount) OVER (ORDER BY recID) AS balance FROM myAccountName") into tSQL I have settled on my earlier suggestion Earlier suggestion results in 20ms performance. _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode