现在的要求就是查询出 指定年的第几季度到指定年的第几季度的数据
下面是我写的一段代码 就是查询 季度到季度之间 只显示一个季度 判断条件不知该怎么写
<select id="findJi" resultType="java.util.HashMap">
select distinct
<foreach collection="table" item="employeeId" index="index"
open="" close="" separator="">
<choose>
<when test="employeeId!=null and employeeId!=''">
Round(avg(${employeeId})over(partition by year),2)
as b${index},
</when>
<when test="employeeId==null and employeeId==''">
'' as b${index}
</when>
</choose>
</foreach>
<if test="cnzTable!=null and cnzTable!=''">
<foreach collection="cnzTable" item="cnz" index="index"
open="" close="" separator="">
<choose>
<when test="cnz!=null and cnz!=''">
(select Round(avg(${cnz}),2) from T_SQ_DATA_STATISTIC_MONTH c
where STATION_ID=${stationName} and
<!-- decode(month_order,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4)
between ${sJi} and ${eJi} -->
decode(c.month_order,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4)>=to_number(${sJi})
and
decode(c.month_order,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4) <![CDATA[<=]]>to_number(${eJi})
) as a${index},
</when>
<when test="cnz==null and cnz==''">
'' as a${index}
</when>
</choose>
</foreach>
</if>
<if test="cnzTable==null or cnzTable==''">
<foreach collection="table" item="employeeId" index="index"
open="" close="" separator="">
<choose>
<when test="employeeId!=null and employeeId!=''">
(select Round(avg(${employeeId}),2) from T_MSIS_BE_HIST_MONTH d
where
STATION_ID=t.STATION_ID
<!-- and decode(month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4)
between ${sJi} and ${eJi} -->
and
decode(d.month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4)>=to_number(${sJi})
and
decode(d.month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4) <![CDATA[<=]]>to_number(${eJi})
)as a${index} ,
</when>
<when test="employeeId==null and employeeId==''">
'' as a${index}
</when>
</choose>
</foreach>
</if>
(year||'年'||decode(decode(t.month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4),'1','春季','2','夏季','3','秋季','4','冬季'))
data1
from T_MSIS_BE_HIST_MONTH t
where
STATION_ID=${stationName}
<!-- and decode(t.month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4)
between ${sJi} and ${eJi} -->
and
decode(t.month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4)>=to_number(${sJi})
and
decode(t.month,'1',1,'2',1,'3',1,'4',2,'5',2,'6',2,'7',3,'8',3,'9',3,'10',4,'11',4,'12',4) <![CDATA[<=]]>to_number(${eJi})
and t.year>=to_number(${start}) and t.year <![CDATA[<=]]>to_number(${end})
order by data1
</select>
求大神帮帮忙