Ok, thanks. Dave
Ward Analytics Ltd - information in motion Tel: +44 (0) 118 9740191 Fax: +44 (0) 118 9740192 www: http://www.ward-analytics.com Registered office address: The Oriel, Sydenham Road, Guildford, Surrey, United Kingdom, GU1 3SR Registered company number: 3917021 Registered in England and Wales. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kees Nuyt Sent: 09 June 2013 10:25 To: [email protected] Subject: Re: [sqlite] Updating a table from itself On Sun, 9 Jun 2013 09:55:30 +0100, "Dave Wellman" <[email protected]> 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: [email protected] >[mailto:[email protected]] On Behalf Of Igor Tandetnik >Sent: 08 June 2013 20:01 >To: [email protected] >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 [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

