Good ! I've not seen like this ! but why "where t2.DATE <= mytable.DATE" instead of where "t2.DATE < mytable.DATE" because what about if ACCOUNT soon exists with no null value and you want to update?
Igor Tandetnik wrote: > > c.panel <[EMAIL PROTECTED]> wrote: >> one example: >> Suppose I have a table with column DATE, CREDIT, DEBIT >> I want to create a new column that is the balance of account >> (ACCOUNT). >> My first approach is to index the table on dates, then starting with >> 0, then ACCOUNT = preceding ACCOUNT + CREDIT - DEBIT. >> But how can I do this in SQL with no cursor ? > > update mytable set ACCOUNT = ( > select sum(CREDIT - DEBIT) from mytable t2 > where t2.DATE <= mytable.DATE > ); > > Igor Tandetnik > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://www.nabble.com/Simple-problem---tp18262458p18263521.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users