SELECT l.refname, max(l.lskinid) AS 'lskin', AVG(DATEDIFF(SECOND,p.call_begin_datetime,s.lastAttempt))/60 AS 'Share Time'
FROM z.z2.dbo.xcall_share s
JOIN z.z2.dbo.xxml_join j ON j.xxml_joinid = s.frn_xxml_joinid
JOIN lskin l ON l.lskinid = j.frn_lskinid
JOIN vwXCall_ShortLong_Platform p ON p.frn_callid = s.frn_callid
JOIN vwXCall_ShortLong_Details d ON d.frn_callid = s.frn_callid
JOIN dnis n ON n.lednis = p.dnis
WHERE l.lskinid = 61926
AND p.call_begin_datetime >= '2017-03-01'
AND n.isoutbound = 0
GROUP BY l.refname
ORDER BY 'Share Time' desc