IF OBJECT_ID ('dbo.RevisedBudgetIncome','V') IS NOT NULL DROP VIEW dbo.RevisedBudgetIncome
GO 
CREATE VIEW dbo.RevisedBudgetIncome
AS 
SELECT 
    ROW_NUMBER() OVER (
        ORDER BY 
            p.CompanyID, 
            p.ProjectID
    ) AS RowKey,
CompanyID, 
ProjectID, 
SUM(RevisedAmount) as RevisedAmount
from PMBudget p 
WHERE p.[Type] = 'I'
 group by p.CompanyID,
          p.ProjectID