为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:8
【操作系统】:win10
【CPU】:
【问题描述】*:where collect_ingredient = '101' and ciip_delete = '0'
and collect_blood_scheme in ('8100453120604000000','4100453120324000000','610045317422000000','610045318032000000') and enough ='0'
and case when '${start_time}' = '01' then collect_blood_time between to_timestamp(concat('${年份}'-1, '-12-26 00:00:00'), 'YYYY-MM-DD HH24:MI:SS')
and to_timestamp(concat('${年份}', '-', '${end_time}', '-25 23:59:59'), 'YYYY-MM-DD HH24:MI:SS')
else
collect_blood_time between to_timestamp(concat('${年份}', '-', '${start_time}'-1, '-26 00:00:00'), 'YYYY-MM-DD HH24:MI:SS')
and to_timestamp(concat('${年份}', '-', '${end_time}', '-25 23:59:59'), 'YYYY-MM-DD HH24:MI:SS')
end使用达梦语法怎么改造?求大神解答
用下面的条件替换试试看是否有效
/*and case when '${start_time}' = '01'
then time between to_timestamp(concat('${年份}'-1, '-12-26 00:00:00'), 'YYYY-MM-DD HH24:MI:SS')
and to_timestamp(concat('${年份}', '-', '${end_time}', '-25 23:59:59'), 'YYYY-MM-DD HH24:MI:SS')
else time between to_timestamp(concat('${年份}', '-', '${start_time}'-1, '-26 00:00:00'), 'YYYY-MM-DD HH24:MI:SS')
and to_timestamp(concat('${年份}', '-', '${end_time}', '-25 23:59:59'), 'YYYY-MM-DD HH24:MI:SS')
end*/
and ( ( ('${start_time}' = '01')
and (time between to_timestamp(concat('${年份}'-1, '-12-26 00:00:00'), 'YYYY-MM-DD HH24:MI:SS')
and to_timestamp(concat('${年份}', '-', '${end_time}', '-25 23:59:59'), 'YYYY-MM-DD HH24:MI:SS')
)
)
or ( ('${start_time}' <> '01')
and (time between to_timestamp(concat('${年份}', '-', '${start_time}'-1, '-26 00:00:00'), 'YYYY-MM-DD HH24:MI:SS')
and to_timestamp(concat('${年份}', '-', '${end_time}', '-25 23:59:59'), 'YYYY-MM-DD HH24:MI:SS')
)
)
)
有完整的sql语句吗?