有人可以帮帮我吗?我不确定为什么这段代码一直不执行:
'0' || CASE
WHEN (EAmain.ActivityStopMin - EAmain.ActivityStartMin) < 0 THEN (DATEDIFF(hh,EAmain.ActivityStartTimeHours || ':' || EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' || EAmain.ActivityStopTimeMin)-1)
WHEN (EAmain.ActivityStopMin - EAmain.ActivityStartMin) >= 0 THEN
(DATEDIFF(hh,EAmain.ActivityStartTimeHours || ':' || EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' || EAmain.ActivityStopTimeMin))
END || ':' || (DATEDIFF(n,EAmain.ActivityStartTimeHours || ':' || EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' || EAmain.ActivityStopTimeMin)#60) || '0' AS ActivityTotalTime,
编辑:我找到了错误代码,这里是:
错误 #5540:SQLCODE:-29 消息:在适用的表中找不到字段 'EAMAIN.ACTIVITYSTOPMIN' THEN SUBSTR (ActivityTotalTime, ?, ?) WHEN LEN (ActivityTotalTime) = ? THEN ActivityTotalTime END AS ActivityTotalTime , Discipline FROM (SELECT Demographics . Name , Visits . Start_Time , Visits . Stop_Time , Visits . Visit_Date , Visits . Total_Time , EAmain . ActivityStartTime , EAmain . ActivityStopTime , ? || CASE WHEN (EAmain . ActivityStopMin -
再次编辑!:此代码是在 CASE 语句之前实现的,并且有效:
'0' || DATEDIFF(hh,EAmain.ActivityStartTimeHours || ':' ||
EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||
EAmain.ActivityStopTimeMin) || ':' || (DATEDIFF(n,EAmain.ActivityStartTimeHours || ':' ||
EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||
EAmain.ActivityStopTimeMin)#60) || '0' AS ActivityTotalTime,