2014-04-21 53 views
0

我不斷收到錯誤「無效標識符」,我知道列是正確的......任何想法?無效的標識符。它是concat代碼嗎?

另外,我知道concat編碼是一種混亂。有人提供了這個代碼:

,mp_asin.PARENT_ASIN_NAME || ', ' || mp_asin.COLOR_NAME as TEEN 

哪會更好?

SELECT 
    mp_asin.CATEGORY_CODE AS Category_id 
    ,mp_asin.SUBCATEGORY_CODE AS SUBCATEGORY 
    ,mp_asin.PARENT_ASIN 
    ,mp_asin.PARENT_ASIN_NAME 
    ,mp_asin.COLOR_NAME AS Color_Name 
    ,mp_asin.PRODUCT_SITE_LAUNCH_DAY AS PSLD 
    ,CONCAT(mp_asin.PARENT_ASIN_NAME, CONCAT(',', CONCAT(' ',mp_asin.COLOR_NAME))) AS Teen 
    ,mp.BRAND_CODE AS Brand_Code 
    ,mp.REPLENISHMENT_CODE as REPLEN_CODE 
    ,mp.REPLENISHMENT_CATEGORY_ID AS Replen_TIER 
    ,mp.ASIN as ASIN 
    , MIN(mp.REPLENISHMENT_CODE) OVER (PARTITION BY (CONCAT(mp_asin.PARENT_ASIN_NAME, CONCAT(',', CONCAT(' ',mp_asin.COLOR_NAME))))) as MIN_TEEN_RC 
    , MAX(mp.REPLENISHMENT_CODE) OVER (PARTITION BY (CONCAT(mp_asin.PARENT_ASIN_NAME, CONCAT(',', CONCAT(' ',mp_asin.COLOR_NAME))))) as MAX_TEEN_RC 

FROM 
D_MP_ASINS mp 

WHERE 
MIN_TEEN_RC <> MAX_TEEN_RC 
AND mp.PRODUCT_CATEGORY =('30905500') 
AND mp_asin.SUBCATEGORY_CODE =('30905560') 
AND mp.REGION_ID = 1 
AND mp.MARKETPLACE_ID = 1 
AND mp.GL_PRODUCT_GROUP = 309 

Group by 
mp_asin.CATEGORY_CODE 
,mp_asin.SUBCATEGORY_CODE 
,mp_asin.PARENT_ASIN 
,mp_asin.PARENT_ASIN_NAME 
,mp_asin.COLOR_NAME 
,mp_asin.PRODUCT_SITE_LAUNCH_DAY 
,CONCAT(mp_asin.PARENT_ASIN_NAME, CONCAT(',', CONCAT(' ',mp_asin.COLOR_NAME))) 
,mp.BRAND_CODE 
,mp.REPLENISHMENT_CODE 
,mp.REPLENISHMENT_CATEGORY_ID 
,mp.ASIN 
+0

你檢查錯別字?另外,什麼是完整的錯誤信息? –

+0

以下是錯誤代碼: – user3534580

+0

聲明1無效。 ORA-00904:「MP_ASIN」。「COLOR_NAME」:無效的標識符 – user3534580

回答

2

我想你錯過了表,別名mp_asin。我在FROM條款中只看到一個表格。

這是更好的,更具可讀性:

mp_asin.PARENT_ASIN_NAME || ', ' || mp_asin.COLOR_NAME as TEEN