x wrote:
> If I replace the following statement
>
> UPDATE SomeTable SET SomeCol = Col1 * (LongWindedFormala) + Col2 * 
> (LongWindedFormala)  + .......
>
> with
>
> WITH CTE(X) AS (SELECT LongWindedFormula)
> UPDATE SomeTable SET SomeCol = Col1 * (SELECT X FROM CTE) + Col2 * (SELECT X 
> FROM CTE) + .....
>
> Is ‘(SELECT X FROM CTE)’ the briefest way of accessing LongWindedFormula?

If LongWindedFormula returns a single value and does not access any column of 
the
table, then this is correct.

(In a SELECT query, you could join with the CTE and then directly access the
column as "X", but UPDATE does not support joins.)

> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

Please do not send ads.


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

Reply via email to