I trying to create this update statement that adds the average runtimes from today into a temporary table. I keep getting the following syntax error:
ERROR: ERROR: syntax error at or near "INNER" Position: 22
Query = UPDATE temptbl1 AS T INNER JOIN ( select jobno, avg(elaptime) as avgrun from cmr_runinf where to_timestamp(timestmp, 'YYYYMMDDHH24MISS') > (now() - interval '1 DAY') GROUP BY JOBNO ) AS source ON T.jobno = source.jobno SET T.todayrun = source.avgrun
My statement:
UPDATE temptbl1 AS T
INNER JOIN
(
select jobno, avg(elaptime) as avgrun
from cmr_runinf
where to_timestamp(timestmp, 'YYYYMMDDHH24MISS') > (now() - interval '1 DAY')
GROUP BY JOBNO
) AS source
ON T.jobno = source.jobno
SET T.todayrun = source.avgrun