All Forums Database
Krishan.R 7 posts Joined 01/06
09 Feb 2006
Update using the result of a SELECT

Can some one help me to know why this update statement fails. Is it possible to useupdate using the select statement like this. Your help would be highly appreciated.###############update CPU_STAT_MATRIX set TOTAL_CPU_ALL_DAY=(select sum(TotalCpuTime) from DBC.QryLog WHERE CAST(firststeptime as DATE)= (CURRENT_DATE - 1 ) AND TotalCpuTime > 0) WHERE ex_date=CURRENT_DATE-1;################Here is the error: *** Failure 3706 Syntax error: expected something between '(' and the 'sele ct' keyword. Statement# 1, Info =55 *** Total elapsed time was 1 second. BTEQ -- Enter your DBC/SQL request or BTEQ command:Krishan.R

09 Feb 2006

I am not sure about the table names and the field name that you have but i guess this is how you have to write this queryupdate cpu_stat_matrixfrom (select sum(TotalCpuTime) from DBC.QryLog WHERE CAST(firststeptime as DATE)= (CURRENT_DATE - 1 ) AND TotalCpuTime > 0) a(total_time)set total_cpu_all_day = a.total_timewhere ex_date=CURRENT_DATE-1;

You must sign in to leave a comment.