I have a table as below:
As You see, the column
officebudge updated with value for all individual offices. i want the
update happen only top 1 office
any suggesion to update the top 1 record?
I used below code. but it updates all the office entries:
UPDATE budget SET officebudge = ISNULL(ProjectedReturnCount,0) FROM analyticsdata join ( select ofc.officeid,ofc.week, max(ISNULL(ofc.ProjectedReturnCount,0)) ProjectedReturnCount from BudgetOffice ofc INNER JOIN budget anal on ofc.OfficeID = anal.OfficeID and ofc.Week = anal.week and ofc.RowStatus = 'a' group by ofc.OfficeID,ofc.week )z on (z.officeid = budget.OfficeID and z.Week = budget .week )
thanks for the help.