Now that could be really useful for some things that I'm doing.

Many 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: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of R Smith
Sent: 04 September 2017 12:49
To: sqlite-users@mailinglists.sqlite.org
Subject: Re: [sqlite] Syntax error using CTE and UPDATE

One last thing I forgot to mention, on the topic of making INSERT and 
UPDATE easy -


If you are using SQLite 3.15 or later, you can use Row-value 
functionality to UPDATE several fields in one go from a sub query.

An example of how such an update query might look:

WITH CTE(ID, ta, tb, tc) AS (
     SELECT stuff...
)
UPDATE t SET (a, b, c) = (SELECT ta, tb, tc FROM CTE WHERE CTE.ID = t.ID)
;

INSERT of course can utilize a sub query or VALUES clause directly, 
which provide much the same functionality.

Read more here: http://sqlite.org/rowvalue.html

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to