SELECT
  CS.ClientID,
  CS.GroupName,
  CS.ClientStatus,
  CB.ClientBranchID,
  CB.BranchName AS ClientBranchName,
  CB.BranchStatus AS ClientBranchStatus,
  CB.TerminationDate,
  CB.TerminationReason,
  CB.TerminationNotes,
  fnClientBranchRetainer(CB.ClientBranchID, @aEffectiveDate) AS Retainer
FROM
  taClientBranches AS CB
    LEFT JOIN taClients AS CS ON (CS.ClientID = CB.ClientID)
WHERE
  (CB.ClientID = @nClientID)
