我在编译时在以下sql代码中遇到错误

时间:2019-07-28 12:57:04

标签: sql postgresql

我已经写了下面的代码来获取一些数据,并且正在获取相同的语法错误,请问有人可以帮忙吗?

我尝试了多个编译器,但都显示了不同的错误

SELECT
TO_CHAR(DS.launch_date,'WW') As WK,
TO_CHAR(DS.launch_date,'MM') As Mnth,
DS.region_id,           
DS.marketplace_id, 
DS.merchant_customer_id,                              
DS.FRAUD_STATUS,
SAM.ASIN,
SAM.offer_type_ord,
SAM.offer_type_ship,
SAM.retail_offer_count,
SAM.threep_offer_count,
SAM.FBA_offer_count,
SAM.MFN_offer_count,
SAM.ytd_gv_count_at_asin_level,
SAM.ytd_retail_ftbbgv_at_asin_level,
SAM.ytd_fba_ftbbgv_at_asin_level,
SAM.ytd_mfn_ftbbgv_at_asin_level,
SAM.ytd_gv_count_at_mcid_level,
SAM.ytd_retail_ftbbgv_at_mcid_level,
SAM.ytd_fba_ftbbgv_at_mcid_level,
SAM.ytd_mfn_ftbbgv_at_mcid_level,
SAM.ytd_retail_int_ftbbgv_at_mcid_level,
SAM.ytd_fba_int_ftbbgv_at_mcid_level,
SAM.ytd_mfn_int_ftbbgv_at_mcid_level,
SAM.ytd_retail_gv_at_mcid_level,
SAM.ytd_fba_gv_at_mcid_level,
SAM.ytd_mfn_gv_at_mcid_level,
DDA.gms_org_cncy_code

FROM iss_dimension.d_seller_launches DS

left JOIN STAGING.F_WKLY_SELLER_ASIN_METRIC SAM on DS.merchant_customer_id = SAM.merchant_customer_id
left JOIN STAGING.BOOKER_DDAA DDA on SAM.merchant_customer_id = DDA.merchant_customer_id and SAM.asin = DDA.asin

WHERE           
    DS.SALES_CENTER_ROLLUP IN ('IN Global Group')           
   and DS.MERCHANT_TYPE NOT IN ('Individual SSR')           
   and DS.MARKETPLACE_ID IN ({DS.MARKETPLACE_ID})           
  and  DS.REGION_ID IN ({DS.REGION_ID}) 
and DS.launch_date between to_date('20190101','YYYYMMDD') and to_date('20190601','YYYYMMDD')

0 个答案:

没有答案