This may seem like a very stupid question to some..but I'm new to SQL! I need to assign avg(ExpValue) a name as i am getting the following error: Msg 4511, Level 16, State 1, Procedure ExpenseItem_View1, Line 2 Create View or Function failed because no column name was specified for column 2 .....how do i do this?! CREATE VIEW View_View1 AS SELECT ExpType, avg(ExpValue) FROM Expenses GROUP BY ExpType
CREATE VIEW View_View1 AS SELECT ExpType, avg(ExpValue) AS SomeFancyName FROM Expenses GROUP BY ExpType should work