Not quite sure how to construct this update / insert SQL but I thought some experts could assist me. Essentially I need to insert into the AlertNotes a message for each distinct patient found (based on patientprofileid) a message that would take the value in 'GlobalStartDate' and the value in 'GlobalEndDate' and construct a message something like this:'Global Period 05/09/2011 through 08/07/2011'The only issue I can see is if the patient already has a note in the AlertNotes field. Can I have it add on to the end of the message thats already in that field. SELECT 'PatientName' = dbo.FormatName(pp.Prefix, pp.First, pp.Middle, pp.Last, pp.Suffix), 'PatientId' = pp.PatientId, 'PatientProfileId' = pp.PatientProfileId, 'AlertNotes' = CONVERT(VARCHAR(MAX),pp.AlertNotes), 'Ticket#' = pv.TicketNumber, 'Doctor' = doc.ListName, 'Facility' = fac.ListName, MAXDateOfServiceFrom, 'GlobalStartDate' = pvp.DateOfServiceFrom, 'GlobalEndDate' = DATEADD(DAY, pvp.GPDays, pvp.DateOfServiceFrom), 'GlobalLength' = pvp.GPDaysFROM PatientVisitProcs pvp JOIN PatientVisit pv ON pvp.PatientVisitId = pv.PatientVisitId JOIN DoctorFacility doc ON pv.DoctorId = doc.DoctorFacilityId JOIN DoctorFacility fac ON pv.FacilityId = fac.DoctorFacilityId JOIN PatientProfile pp ON pv.PatientProfileId = pp.PatientProfileId JOIN ( SELECT 'PatientId' = pp.PatientId, 'MAXDateOfServiceFrom' = MAX(pvp.DateOfServiceFrom) FROM PatientVisitProcs pvp JOIN PatientVisit pv ON pvp.PatientVisitId = pv.PatientVisitId JOIN PatientProfile pp ON pv.PatientProfileId = pp.PatientProfileId GROUP BY pp.PatientId ) Z ON Z.PatientID = pp.PatientId AND Z.MAXDateOfServiceFrom = pvp.DateOfServiceFromWHERE ISNULL(GPDays, 0) > 0 AND DATEADD(DAY, pvp.GPDays, pvp.DateOfServiceFrom) > GETDATE() AND ISNULL(pvp.Voided, 0) = 0GROUP BY dbo.FormatName(pp.Prefix, pp.First, pp.Middle, pp.Last, pp.Suffix), pp.PatientId, pp.PatientProfileId, CONVERT(VARCHAR(MAX),pp.AlertNotes), pv.TicketNumber, doc.ListName, fac.ListName, pvp.DateOfServiceFrom, pvp.GPDays, Z.MAXDateOfServiceFromORDER BY MAXDateOfServiceFrom DESC, GlobalEndDate DESC ;--UPDATE dbo.PatientProfile SET AlertNotes = 'Global Period 05/09/2011 through 08/07/2011' WHERE PatientProfileId = 29