SELECT
*,
tDirectory.`CallerID` AS tDirectory_CallerID,
tDirectory.`Category` AS tDirectory_Category,
tDirectory.`Access` AS tDirectory_Access,
tDirectory.`Status` AS tDirectory_Status
FROM
`tDirectory` tDirectory LEFT OUTER JOIN `tTop10NosByCallType` tTop10NosByCallType ON tDirectory.`TelNo` = tTop10NosByCallType.`No` and
tTop10NosByCallType.Client = $P{Client}
WHERE
`Invoice number` = $P{InvNo}
ORDER BY
CallType DESC,
CountByCallType DESC,
DurationHHMM DESC