<select id="querysegmentedTotalStatistics" parameterType="com.hp.operationService.messageexchange.pojo.SmsGatewayStatisticsPojo" resultType="com.hp.operationService.messageexchange.pojo.SmsGatewayStatisticsPojo">
select  orgid,
(select orgname from organize b where a.orgid = b.orgid) orgname,
 count(*) 
 <if test="relatedownsmstable!= null and relatedownsmstable!=''">
 from ${ relatedownsmstable} a
 </if>
  group by orgid
union all
select  orgid,(select orgname from organize b where a.orgid = b.orgid) orgname,count(*)
<if test="relatedownsmstable!= null and relatedownsmstable!=''">
from ${ relatedownsmstable} a
</if>
group by orgid
union all
select  orgid,(select orgname from organize b where a.orgid = b.orgid) orgname,count(*)
<if test="relatedownsmstable!= null and relatedownsmstable!=''">
from ${relatedownsmstable} a
</if>
group by orgid
union all
select  orgid,(select orgname from organize b where a.orgid = b.orgid) orgname,count(*)
<if test="relatedownsmstable!= null and relatedownsmstable!=''">
from ${ } a
</if>
group by orgid
</select> 
  
请问我这样写为什么报这个错误?在线等大神解答