0 - 5 of 5 tags for #Error 3707

SELECT

sales_segment,

pickup_yyyymm,

AVERAGE (Days) OVER (PARTITION  BY  sales_segment + pickup_yyyymm ORDER BY  sales_segment,pickup_yyyymm DESC)  AS mean_days,

MAX (Days) OVER (PARTITION  BY sales_segment + pickup_yyyymm ORDER BY sales_segment,pickup_yyyymm DESC) AS max_days,

I'm trying to add a field from a different table to a derived query.  This is the first time I have tried to do this.  The query below was working unitl I added the bolded information below.  The error message is as follows:
SELECT Failed.  3707: Syntax error, expected something like ')' between 'soh' and '.'

CREATE SANDBOX.SC2_VDGB  (
  MAIN_ID VARCHAR(12)  
, PLAN_NBR VARCHAR(9)  
, MEMBER_NAME VARCHAR(64)  
, CASE_NBR VARCHAR(9)  
...
, X8 VARCHAR(1)  
, XB VARCHAR(1)  
, XC VARCHAR(1)  
, XD VARCHAR(1)  
, DAHS_FACILITY_PROV_NBR VARCHAR(12)  
, DAHS_FACILITY_NAME VARCHAR(64)  
, PRODUCT VARCHAR(2) 
) 
PRIMARY INDEX (MAIN_ID);

Hi All,
 
I am facing with the below TPT error. I am not sure where to correct the code.

 

**** 18:42:33 TPT10508: RDBMS error 3707: Syntax error, expected something like a name or a Unicode delimited identifier or an 'UDFCALLNAME' keyword between the 'USING' keyword and the 'DELETE' keyword.

SELECT  oute.*

FROM PDP_TMP.EV_SBSCRP_BTS_USG oute

WHERE  

CASE WHEN oute.PROD_TYPE= EVO

THEN oute.TotalDataCount  =  SELECT  MAX (inne.TotalDataCount)

                                                FROM PDP_TMP.EV_SBSCRP_BTS_USG inne