我想在Ibatis中做一个复杂的动态选择语句,就像这样
select * from emp
//when dateParam between 2012-03-1 and 2013-03-01 then
union
select * from emp1
//when dateParam between 2014-03-1 and 2015-03-01 then
union
select * from emp2
答案 0 :(得分:0)
我这样做:
select * from emp
<isLessEqual property="dateParam" compareValue="2015-03-01">
union
select * from emp1
</isLessEqual>
<isLessEqual property="dateParam" compareValue="2013-03-01">
union
select * from emp1
</isLessEqual>