维斯 ๑ 2008-06-25 10:35
浏览 479
已采纳

ibatis sql语句 大于等于号的问题

刚接触IBATIS,希望大家能够帮忙看一下.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap

PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-2.dtd">














select ltrim(substr(report_date,7,2),0) day,
min(starttime) starttime,
max(endtime) endtime,
case
when min(starttime)[color=red][b]<=[/b][/color]'12:00' and max(endtime)<='12:00'
then (to_date(max(endtime),'hh24:mi')-to_date(min(starttime),'hh24:mi'))*24
when (min(starttime)>='12:00' and min(starttime)<='13:00') and (max(endtime)>='12:00' and max(endtime)<='13:00')
then 0
when min(starttime)>='13:00' and max(endtime)>='13:00'
then (to_date(max(endtime),'hh24:mi')-to_date(min(starttime),'hh24:mi'))*24
when min(starttime)<='12:00' and (max(endtime)>='12:00' and max(endtime)<='13:00')
then (to_date('12:00','hh24:mi')-to_date(min(starttime),'hh24:mi'))*24
when min(starttime)<='12:00' and max(endtime)>='13:00'
then (to_date(max(endtime),'hh24:mi')-to_date(min(starttime),'hh24:mi'))*24-1
when (min(starttime)>='12:00' and min(starttime)<='13:00') and max(endtime)>='13:00'
then (to_date(max(endtime),'hh24:mi')-to_date('13:00','hh24:mi'))*24
end worktime,
report_date,substr(max(sys_connect_by_path(workcontent,',')),2) workcontent,
max(department) department,
max(team) team,
max(confirm) confirm
from (select dailyreport.*,row_number() over(partition by report_date order by workcontent) rn from dailyreport)
where login_id=#loginid# and substr(report_date,0,6)=#reportdate#
group by report_date
start with rn=1
connect by rn-1=prior rn and report_date=prior report_date

问题:
如粗体红色部分所示,IBATIS中这样写报错.在网上查了一下,除等于外一般用动态SQL这种写法
问题是我的写在CASE WHEN 语句中,应该怎么样修改....迷茫中...等待大好人....

  • 写回答

2条回答 默认 最新

  • lggegegmail 2008-06-25 11:21
    关注

    http://www.iteye.com/problems/624

    这个里面有答案.. 哈哈

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog