<iftest="industry != null and industry=='1'.toString()">
<iftest="industry != null and industry=='1'.toString()">
count(Distinct IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'), so.client_id,0)) as industry_trans_clients,
count(Distinct IF((c.royalpayindustry =1 or (c.royalpayindustry like '100%' and CHAR_LENGTH(c.royalpayindustry)=5)), so.client_id,0)) as industry_trans_clients,
SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.total,0)) as industry_total_amount,
SUM(IF((c.royalpayindustry =1 or (c.royalpayindustry like '100%' and CHAR_LENGTH(c.royalpayindustry)=5)),so.total,0)) as industry_total_amount,
SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.orders,0)) as industry_orders,
SUM(IF((c.royalpayindustry =1 or (c.royalpayindustry like '100%' and CHAR_LENGTH(c.royalpayindustry)=5)),so.orders,0)) as industry_orders,
convert(SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.total,0))/sum( so.total )*100,decimal(15,2)) as amount_pcent,
convert(SUM(IF((c.royalpayindustry =1 or (c.royalpayindustry like '100%' and CHAR_LENGTH(c.royalpayindustry)=5)),so.total,0))/sum( so.total )*100,decimal(15,2)) as amount_pcent,
convert(SUM(IF((c.royalpayindustry =1 or c.royalpayindustry like '100%'),so.orders,0))/sum( so.orders )*100,decimal(15,2)) as order_pcent,
convert(SUM(IF((c.royalpayindustry =1 or (c.royalpayindustry like '100%' and CHAR_LENGTH(c.royalpayindustry)=5)),so.orders,0))/sum( so.orders )*100,decimal(15,2)) as order_pcent,
</if>
</if>
<iftest="industry == null or industry=='0'.toString()">
<iftest="industry == null or industry=='0'.toString()">
count(Distinct so.client_id) as industry_trans_clients,
count(Distinct so.client_id) as industry_trans_clients,
@ -1164,7 +1164,7 @@
inner JOIN sys_clients c ON so.client_id = c.client_id
inner JOIN sys_clients c ON so.client_id = c.client_id
AND c.is_valid = 1
AND c.is_valid = 1
<iftest="industry != null and industry=='1'.toString()">
<iftest="industry != null and industry=='1'.toString()">
AND (c.royalpayindustry =1 or c.royalpayindustry like '100%')
AND (c.royalpayindustry =1 or (c.royalpayindustry like '100%' and CHAR_LENGTH(c.royalpayindustry)=5))
</if>
</if>
<iftest="industry != null and industry!='0'.toString() and industry!='1'.toString()">
<iftest="industry != null and industry!='0'.toString() and industry!='1'.toString()">