select A.log_date,A.log_filtime ,B.realname,B.username, 
(select count(*) from tablec where id = A.id) as 该日志的评论数
 from tablea as A left join tableb as B on A.username = B.username 
  where A.username = @某个部门员工