REPLACE INTO taAppointmentFilter (
  AppointmentID,
  AppointmentStage,
  Consultant,
  BookedBy,
  GroupName,
  FinNumber,
  InvoiceNumber,
  AppointmentType,
  LabourNetBranch,
  ProductName,
  ProductCategory
)
  SELECT
    AP.AppointmentID,
    AP.AppointmentStage,
    U1.FullName AS Consultant,
    U2.FullName AS BookedBy,
    CS.FinNumber,
    CS.GroupName,
    AP.InvoiceNumber,
    AT.AppointmentType,
    BR.BranchName AS LabourNetBranch,
    PR.ProductName,
    PR.ProductCategory
  FROM
    tbAppointments AS AP
      LEFT JOIN taClients AS CS ON (CS.ClientID = AP.ClientID)
      LEFT JOIN taUsers AS U1 ON (U1.UserID = AP.ConsultantID)
      LEFT JOIN taUsers AS U2 ON (U2.UserID = AP.BookedByID)
      LEFT JOIN tbAppointmentTypes AS AT ON (AT.AttendanceTypeID = AP.AttendanceTypeID)
      LEFT JOIN taBranches AS BR ON (BR.BranchID = AP.ConsultantBranchID)
      LEFT JOIN taProducts AS PR ON (PR.ProductID = AP.ProductID)
  WHERE
    (AP.AppointmentID = @nAppointmentID)
