case when then else end mysql
select (@rownum:=@rownum+1) AS serial_Num, tb_ser.name as server_Name, count(tb_uer.id) as regist_Num ,
count(case when tb_uer.status=0 then tb_uer.id else null end) as no_Active,
count(case when date_format(tb_uer.lastLoginTime,'%Y-%m-%d')= @con1 then tb_uer.id else null end) as active_Num,
count(tb_uer.id)-count(case when date_format(tb_uer.lastLoginTime,'%Y-%m-%d')=@con1 then tb_uer.id else null end) as no_Active_Num
from p_service_branch tb_ser left join
p_cuser tb_uer on tb_uer.serviceId=tb_ser.id
,(SELECT @rownum:=0) rownumber where 1=1 @con2 @con3 group by tb_ser.id