select t2.tenterprise_userid,
       t2.fname,
       t2.fphonenumber,
       MAX(t4.createdate) as                              flastreadtime,
       count(distinct t4.tarchives_sc_useid)              freadcount,
       sum(DATEDIFF(MINUTE, t4.createdate, t4.closedate)) freadtimes
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 t4
                   on t1.siteid = t4.siteid and t2.tenterprise_userid = t4.tenterprise_userid and
                      t1.tarchives_scid = t4.tarchives_scid
where t1.siteid = $siteid$
  and t1.tarchives_scid=$tarchives_scid$
  and
    not exists (
    select tenterprise_userid from tattachment
    inner join tattachment_downlog on tattachment.siteid=tattachment_downlog.siteid
  and tattachment.tattachmentid=tattachment_downlog.tattachmentid
    where tattachment.siteid=t1.siteid
  and tattachment.ownertable='tarchives_sc'
  and tattachment.ownerid=$tarchives_scid$
  and tattachment_downlog.tenterprise_userid=t2.tenterprise_userid
    )
group by t2.tenterprise_userid, t2.fname, t2.fphonenumber