mybatis 对string类型判断比较 group case when then 综合

[quote]

特别注意两点 一个是where 的用法
group的用法
case when的用法


这个对string的比较 是单引号 括起test后面的整串, 然后 == 然后双引号括起比较的字符串内容

[/quote]
[quote]



[/quote]

[quote]
select * from (
SELECT
s.salesman_id as salesmanId,
s.salesman_name as salesmanName,
s.id_no as idNo,
s.id_type as idType,
s.phone_no as phoneNo,
s.channel_id as channelId,
s.register_date as registerDate,
s.profession as profession,
s.email as email,
count(case when ob.apply_status = 7 then ob.apply_status else 0 end) as reject_count,
count(case when ob.apply_status > 1 and ob.apply_status < 6 then ob.apply_status else 0 end) as inprogress_count,
count(case when ob.apply_status > 0 then ob.apply_status else 0 end) as total_count,
count(case when ob.release_status = 1 then ob.apply_status else 0 end) as release_status,
sum(case when ob.release_status = 1 then ob.release_money else 0 end) as total_release_amt
from salesman s left join order_base ob
on s.salesman_id = ob.user_id
where s.salesman_id = 1
group by s.salesman_id,s.salesman_name,s.id_no,s.id_type,s.phone_no,s.channel_id,s.register_date,s.profession,s.email


) t
[/quote]

你可能感兴趣的:(sql,mybatis)