Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-10-01 Thread Thomas Kellerer
Matthias Nagel wrote on 29.09.2012 12:49: Hello, is there any way how one can store the result of a time-consuming calculation if this result is needed more than once in an SQL update query? This solution might be PostgreSQL specific and not standard SQL compliant. Here is an example of what

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-10-01 Thread Jasen Betts
On 2012-09-29, Matthias Nagel wrote: > Hello, > > is there any way how one can store the result of a time-consuming calculation > if this result is needed more than once in an SQL update query? This solution > might be PostgreSQL specific and not standard SQL compliant. Here is an > example of

Re: [SQL] Reuse temporary calculation results in an SQL update query [SOLVDED]

2012-09-30 Thread David Johnston
> > thank you. The "WITH" clause did the trick. I did not even know that such a > thing exists. But as it turns out it makes the statement more readable and > elegant but not faster. > > The reason for the latter is that both the CTE and the UPDATE statement > have the same "FROM ... WHERE ..." p

Re: [SQL] Reuse temporary calculation results in an SQL update query [SOLVDED]

2012-09-29 Thread Matthias Nagel
Hello, thank you. The "WITH" clause did the trick. I did not even know that such a thing exists. But as it turns out it makes the statement more readable and elegant but not faster. The reason for the latter is that both the CTE and the UPDATE statement have the same "FROM ... WHERE ..." part,

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-09-29 Thread Andreas Kretschmer
Thomas Kellerer hat am 29. September 2012 um 16:13 geschrieben: > Matthias Nagel wrote on 29.09.2012 12:49: > > Hello, > > > > is there any way how one can store the result of a time-consuming > > calculation if this result is needed more > >than once in an SQL update query? This solution might

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-09-29 Thread Thomas Kellerer
Matthias Nagel wrote on 29.09.2012 12:49: Hello, is there any way how one can store the result of a time-consuming calculation if this result is needed more than once in an SQL update query? This solution might be PostgreSQL specific and not standard SQL compliant. Here is an example of what

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-09-29 Thread David Johnston
On Sep 29, 2012, at 6:49, Matthias Nagel wrote: > Hello, > > is there any way how one can store the result of a time-consuming calculation > if this result is needed more than once in an SQL update query? This solution > might be PostgreSQL specific and not standard SQL compliant. Here is an

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-09-29 Thread Matthias Nagel
Hello, > Matthias Nagel hat am 29. September 2012 um 12:49 > geschrieben: > > Hello, > > > > is there any way how one can store the result of a time-consuming > > calculation > > if this result is needed more than once in an SQL update query? This > > solution > > might be PostgreSQL specific a

Re: [SQL] Reuse temporary calculation results in an SQL update query

2012-09-29 Thread Andreas Kretschmer
Matthias Nagel hat am 29. September 2012 um 12:49 geschrieben: > Hello, > > is there any way how one can store the result of a time-consuming calculation > if this result is needed more than once in an SQL update query? This solution > might be PostgreSQL specific and not standard SQL compliant.

[SQL] Reuse temporary calculation results in an SQL update query

2012-09-29 Thread Matthias Nagel
Hello, is there any way how one can store the result of a time-consuming calculation if this result is needed more than once in an SQL update query? This solution might be PostgreSQL specific and not standard SQL compliant. Here is an example of what I want: UPDATE table1 SET StartTime = 't