आपको काउंटरसम द्वारा भी समूह बनाना होगा।
create table call_log (
user_id int(10),
duration int(10) );
insert into call_log values ( 5019,12),
( 2345,23),
( 5019,14);
create table job_timetable (
user_id int(10),
counter int(10) );
insert into job_timetable values ( 5019,1),
( 5019,3),
( 2345,2);
SELECT call_log.user_id,SUM(call_log.duration) as duration,
avg(call_log.duration) as average_duration,
countersum
FROM call_log
LEFT JOIN ( SELECT user_id,sum(counter) as countersum FROM job_timetable
GROUP BY user_id ) b on call_log.user_id= b.user_id
where call_log.user_id is not null
group by call_log.user_id,countersum
order by call_log.user_id asc;
डेमो:https://www.db-fiddle.com/f/7yUJcuMJPncBBnrExKbzYz/77