sample syntax having TOP3
UPDATE dbo.tblRptWordWeekly_Paragraph1Sourcemini
SET d1MinistryName = MinistryName
,d1Actual = Actual
,d1PActual = pActual
FROM
(SELECT TOP 3 ROW_NUMBER() OVER (ORDER BY (SUM(Curr_Actual) + SUM(Inv_Actual))/(SUM(Curr_BG) + SUM(Inv_BG)) *100 DESC ) d1Row
,Ministry_Name MinistryName
,SUM(Curr_Actual) + SUM(Inv_Actual) Actual
,(SUM(Curr_Actual) + SUM(Inv_Actual)) / ((SUM(Curr_BG) + SUM(Inv_BG))) * 100 pActual
FROM vw_LatestOutputActual_2556
GROUP BY Ministry_Name) AS TempTable
WHERE d1Row=1
It's work not error!!!!
0 ความคิดเห็น:
แสดงความคิดเห็น