SELECT IdField, AVG(NumericField)
FROM Table
GROUP BY IdField
INSERT INTO AnotherTable
SELECT IdField, AVG(NumericField)
FROM Table
GROUP BY IdField
CREATE PROCEDURE MyProcedure
AS
INSERT INTO AnotherTable
SELECT IdField, AVG(NumericField)
FROM Table
GROUP BY IdField
GO
Looking for relevant SQL Server Whitepapers? Visit the SearchSQLServer.com Research Library.
Mrdenny | Mar 16 2008 11:36PM GMT
Check out my SQL Server blog “SQL Server with Mr Denny” for more SQL Server information.
Specifically you may want to check out my Back To Basics series which I’ve just started on my blog. So far I’ve only covered the SELECT statement, but the other commands will be coming shortly.