I have one query that I'm testing times with.
I get two different times and this is making me doubt the correctness of my data.
Here are the two examples :
SELECT
users.fname as counselor,
count(session.anum) as students,
SEC_TO_TIME(AVG(TIME_TO_SEC(TIMEDIFF(starttime, signintime)))) AS 'AVG Wait Time',
SEC_TO_TIME(AVG(TIME_TO_SEC(TIMEDIFF(finishtime, starttime)))) AS 'AVG Session Length'
FROM session
LEFT JOIN support
ON support.session_id = session.session_id
LEFT JOIN users
ON users.username = support.counselor
WHERE session.status = 3
GROUP BY fname;
This returns :
00:01:17 and 00:00:05
the next query is :
SELECT
users.fname as counselor,
count(session.anum) as students,
SEC_TO_TIME(AVG(TIMEDIFF(starttime, signintime))) AS 'AVG Wait Time',
SEC_TO_TIME(AVG(TIMEDIFF(finishtime, starttime))) AS 'AVG Session Length'
FROM session
LEFT JOIN support
ON support.session_id = session.session_id
LEFT JOIN users
ON users.username = support.counselor
WHERE session.status = 3
GROUP BY fname;
00:01:37 and 00:00:05
Why does this happen and which result set am I supposed to trust? Would love if any one can clear my confusion.