select case when t3.tarchives_sc_useid IS null then '未学习' else '已学习' end as ftype,
       count(distinct t2.tenterprise_userid)                             as fcount
from tarchives_sc t1
         inner join tenterprise_users t2 on t1.siteid = t2.siteid and t2.fphonenumber is not null
    and t1.fsalercanread = 1 and t2.fusertype = '企业'
         left join tarchives_sc_userdata t3 on t1.siteid = t3.siteid and t1.tarchives_scid = t3.tarchives_scid and
                                               t2.tenterprise_userid = t3.tenterprise_userid
where t1.siteid = $siteid$ and t1.tarchives_scid = $tarchives_scid$
group by case when t3.tarchives_sc_useid IS null then '未学习'
else'已学习'end
