Re: Reuse temporary calculation results in an SQL update query - Mailing list pgsql-sql

From Andreas Kretschmer
Subject Re: Reuse temporary calculation results in an SQL update query
Date
Msg-id 1237868969.148407.1348916195838.JavaMail.open-xchange@ox.ims-firmen.de
Whole thread Raw
In response to Reuse temporary calculation results in an SQL update query  (Matthias Nagel <matthias.h.nagel@gmail.com>)
Responses Re: Reuse temporary calculation results in an SQL update query
List pgsql-sql

Matthias Nagel <matthias.h.nagel@gmail.com> 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. Here is an
> example of what I want:
>
> UPDATE table1 SET
>    StartTime = 'time consuming calculation 1',
>    StopTime = 'time consuming calculation 2',
>    Duration = 'time consuming calculation 2' - 'time consuming calculation 1'
> WHERE foo;

The Duration - field is superfluous ...

As far as i know there is no way to re-use the result.


Regards, Andreas



pgsql-sql by date:

Previous
From: Matthias Nagel
Date:
Subject: Reuse temporary calculation results in an SQL update query
Next
From: Matthias Nagel
Date:
Subject: Re: Reuse temporary calculation results in an SQL update query