Hi, my question is: is it guaranteed that it works?
Regards, Hartwig Am 07.05.2013 um 03:24 schrieb James K. Lowden: > On Mon, 6 May 2013 23:53:40 +0100 > Simon Slavin <[email protected]> wrote: > >>> How do I create this kind of update statement? >>> >>> UPDATE T SET a=0.5*(a+b), b=0.5*(b-a); >>> >>> The RHS should always be used with the values of a and b before the >>> assignment. >>> >>> I think that the result of this kind of statement is undefined, or? >> >> No need to worry, it will work the way you want it to work: >> >> The row is read. >> The new values are calculated. >> The new values are written to the database. > ... >> That was a terrible description. > > Actually that's not a bad approximation of what happens. Here's a > simpler example: > > sqlite> create table t(a int, b int); > sqlite> insert into t values (1,2); > sqlite> select * from t; > a b > ---------- ---------- > 1 2 > sqlite> update t set a=b, b=a; -- Et Voila! > sqlite> select * from t; > a b > ---------- ---------- > 2 1 > > There is no "RHS". The syntax and semantics of SQL are its own; they > cannot be extrapolated from other languages. I know but everybody knows what I meant, or? And its a quite brief description. > > --jkl > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

