Hi there, I'm having trouble doing an update. Let's say I have:location client insp_date insp_date_end---------------------------------------------------- 1 7 11/17/2010 12/31/9999 1 7 5/4/2011 12/31/9999 2 7 12/16/2010 12/31/9999 3 8 8/25/2010 12/31/9999 3 8 2/1/2011 12/31/9999 3 8 2/7/2011 12/31/9999
And what I'm trying to do get is:location client insp_date insp_date_end---------------------------------------------------- 1 7 11/17/2010 5/4/2011 1 7 5/4/2011 12/31/9999 2 7 12/16/2010 12/31/9999 3 8 8/25/2010 2/1/2011 3 8 2/1/2011 2/7/2011 3 8 2/7/2011 12/31/9999
I'm able to view the results I want (the ones I want to change, that is) with this:SELECT i1.location , i1.client , i1.insp_date , [insp_date_end] = MIN(i2.insp_date)--UPDATE i1 SET-- [insp_date_end] = MIN(i2.insp_date) --doesn't work!FROM #Inspections i1 INNER JOIN #Inspections i2 ON i1.location = i2.location AND i1.client = i2.client AND i1.insp_date < i2.insp_dateGROUP BY i1.location , i1.client , i1.insp_date
I should mention that I'm not a programmer, I didn't set up the database, and I have limited permissions to change anything.Thanks for your help!