Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple update problem
b_addams_at_yahoo.com wrote:
> Thank you! That definitely helps. I did just think of another
> possibility though. Maybe a smarter way to do this would be a test for
> any set where the temperature difference is greater than a certain
> value. With the update above I am not sure how to do this as the final
> where clause is outside the 'tl_good' select clause so obviously I
> can't use the 'tl_good.degrees_f' in the test. Is there an easy way to
> do this?
>
> Bill
>
update temperature_log tl_bad
set (degrees_f, degrees_c) =
(select tl_good.degrees_f, tl_good.degrees_c
from temperature_log tl_good where tl_good.system_timestamp = tl_bad.system_timestamp and tl_good.sensor_address = 'FFFF') where (tl_bad.sensor_address, tl_bad.system_timestamp) in (select g.sensor_address, g.system_timestamp from temperature_log g, temperature_log b where g.sensor_address = '6DA9' and g.system_timestamp between to_date('&dtfrom','YYYYMMDDHH24MISS') and to_date('&dttill','YYYYMMDDHH24MISS') and b.sensor_address = 'FFFF' and b.system_timestamp = g.system_timestamp and b.degrees_f != g.degrees_f /* or something more complex */ )Received on Sat May 21 2005 - 23:12:50 CDT