SELECT DISTINCT
  CB.ClientID,
  CB.ClientBranchID,
  CB.LabourNetBranchID,
  CB.BranchName,
  CB.MapReference,
  CB.NoOfEmployees,
  fnClientBranchRetainer(CB.ClientBranchID, NOW()) AS BranchRetainer
FROM
  taClientBranches AS CB
    LEFT JOIN taClients AS CS ON (CS.ClientID = CB.ClientID)
    LEFT JOIN taFinCategory AS FC ON (FC.FinCategoryID = CS.FinCategory)
WHERE
  (CB.BranchStatus = 1) AND
  (CS.ClientStatus = 1) AND
  (TRIM(CB.MapReference) <> '') AND
  (FC.DebtorClerkID = @nConsultantID)