SELECT `group_name`,`user_id`,`user_family`,`user_name`,`user_otchestvo`,`date`,`sex`,`user_photo`, `job_title`, log_num FROM `category`, `users`, `job`, `log`,SUM(log_num) WHERE users.group_id = category.group_id AND users.job = job.job_id AND users.user_id = log.add_user_id AND MONTH(`log_date`) = MONTH(NOW()) AND YEAR(`log_date`) = YEAR(NOW()) GROUP BY user_id