我試圖從用戶的初始日期到當前日期添加時間(小時分鐘和秒),但我收到了錯誤。從一個時間戳字段添加時間到其他字段
我不知道我做錯了,接受其他的建議
select distinct uid,
min (ts) over (partition by uid order by ts rows unbounded preceding) as initial_date,
current_date-2 + interval 'to_char(min (ts) over (partition by uid order by ts rows unbounded preceding),'HH') hours'
from mr_session_log
where ts >= '2015-09-01'
這個錯誤,我recevied
ERROR: syntax error at or near "') hours'"
的位置:355
current_date-2 + interval 'to_char(min (ts) over (partition by uid order by ts rows unbounded preceding),'HH') hours',
^
CURRENT_DATE-2?這是一個標識符名稱,或者你是否試圖從該領域中減去某些東西?此外,語法突出顯示在提示錯誤信息方面做得很好,但仍應始終發佈錯誤消息。 –
嗨,我已經添加了錯誤,current_date - 2從current_date減少2天 – user3600910