I am stuck on an update query that is using a subquery and have not been able to figure it out after reading the manual and trying different ideas. Below is the table & query. Tables Temp_2, Temp_3 & Temp_4 both have 33 rows in them and no null values.
Any ideas on how to resolve this?
CREATE TABLE temp_2 (
date_value date default NULL,
close_adj_value_1 double default NULL);
CREATE TABLE temp_3 (
date_value date default NULL,
first_close_adj_value_1 double default NULL);
CREATE TABLE temp_4 (
date_value date default NULL,
pct_return_1 double default NULL);
INSERT INTO temp_4 (date_value) SELECT date_value FROM temp_2;
UPDATE temp_4
SET pct_return_1 =
(SELECT ((temp_2.close_adj_value_1 / temp_3.first_close_adj_value_1) - 1)
FROM temp_2,temp_3
WHERE temp_2.date_value = temp_3.date_value);
Thanks, Eric