操作无效:数据值" -1"格式无效;在Redshift中间歇性地发生

时间:2018-02-16 06:36:34

标签: sql amazon-redshift

它有时有效并且有时会失败。我没有看到数据中的任何问题,也不确定我为什么会收到此错误

SELECT (to_date(dd.date_dkey,'YYYYMMDD')::DATE-1) AS weekend,du.dim_user_skey,MAX(ft.rfv) AS rfv_score 
INTO #rfv5
FROM reportingdb.ft_rfv_score_weekly ft
JOIN abstraction.lkp_user lu ON lu.erights_id=ft.erights_id
JOIN abstraction.dim_date dd ON (date_trunc('week', to_date(ISNULL(dd.date,'01/01/2099'),'dd/mm/yyyy')::DATE)::Date-1)=ft.reportdate::date
JOIN  lighthousedb.dim_user du ON du.ft_user_id=lu.ft_user_id
WHERE (to_date(dd.date_dkey,'YYYYMMDD')::DATE-1) < getdate()::date AND ft.reportdate::date > (getdate()-30)
AND dd.date_dkey > 20160101 
GROUP BY (to_date(dd.date_dkey,'YYYYMMDD')::DATE-1),
du.dim_user_skey;

0 个答案:

没有答案