select t1.tenterprise_userid,
       t1.fname,
       t1.fphonenumber,
       MAX(t4.createdate) as                              flastreadtime,
       count(distinct t4.tarchives_userdaid)              freadcount,
       sum(DATEDIFF(MINUTE, t4.createdate, t4.closedate)) freadtimes
from tenterprise_users t1
         left join tarchives_userdata t4
                    on t1.siteid = t4.siteid and t1.tenterprise_userid = t4.tenterprise_userid and t4.tarchivesid =$tarchivesid$
where t1.siteid = $siteid$  and t1.fusertype = 'ÆóÒµ' and t1.tenterprise_userid in $tenterprise_userid$
  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'
  and tattachment.ownerid=$tarchivesid$
  and tattachment_downlog.tenterprise_userid=t1.tenterprise_userid
    )
group by t1.tenterprise_userid, t1.fname, t1.fphonenumber