日期:2014-05-18  浏览次数:20484 次

这个UPDATE 语句为什么错!急...
update   jtl_2005   set   sj_width=(case   sj
  when   between   '00:00:00 '   and   '00:14:59 '   then   '1 '
  when   between   '00:15:00 'and   '00:29:59 '   then   '2 '
                                                            end)

------解决方案--------------------
try

update jtl_2005 set sj_width=(case when sj between '00:00:00 ' and '00:14:59 ' then '1 '
when sj between '00:15:00 'and '00:29:59 ' then '2 '
end)

------解决方案--------------------
update jtl_2005 set sj_width=(case sj
when between '00:00:00 ' and '00:14:59 ' then '1 '
when between '00:15:00 'and '00:29:59 ' then '2 '
--else没有加
else null

end)

------解决方案--------------------


update jtl_2005 set sj_width=
case when sj between '00:00:00 ' and '00:14:59 ' then '1 '
when sj between '00:15:00 'and '00:29:59 ' then '2 '
end
------解决方案--------------------
update jtl_2005 set sj_width=(case when sj between '00:00:00 ' and '00:14:59 ' then '1 '
when sj between '00:15:00 'and '00:29:59 ' then '2 '
end)
when 后面少了条件
------解决方案--------------------
update jtl_2005 set sj_width=(case sj
when between '00:00:00 ' and '00:14:59 ' then '1 '
when between '00:15:00 'and '00:29:59 ' then '2 '
end)
where 条件

------解决方案--------------------
不過可以加上個else

update jtl_2005 set sj_width=
(case when sj between '00:00:00 ' and '00:14:59 ' then '1 '
when sj between '00:15:00 'and '00:29:59 ' then '2 '
Else Null
end)