On Sun, 9 Jun 2013 09:55:30 +0100, "Dave Wellman" <dwell...@ward-analytics.com> wrote:
>Hi Igor, > >Many thanks for that. > >For this example I'm updating a single column (c2). If I needed to update >multiple columns in the table would I need to use the SELECT construct for >each column? Yes. >Cheers, >Dave > >-----Original Message----- >From: sqlite-users-boun...@sqlite.org >[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik >Sent: 08 June 2013 20:01 >To: sqlite-users@sqlite.org >Subject: Re: [sqlite] Updating a table from itself > >On 6/8/2013 2:51 PM, Dave Wellman wrote: >> update t1 from (select c1,c2 from t1) as dt1 set c2 = dt1.c2 where >> t1.c1 = dt1.c2 - 1; > >update t1 set c2 = coalesce((select c2 from t1 dt1 where t1.c1 = dt1.c2 >- 1), c2); -- Groet, Cordialement, Pozdrawiam, Regards, Kees Nuyt _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users