Changed into a procedure, getting a syntax error at \'PROCEDURE\' any ideas?
CREATE PROCEDURE performance_Report
@startDate DATE,
@endDate DATE
AS
SELECT S
No, you cannot do that. You want your view to result in an aggregation by SalesRep.Name. What you want to do is filtering those SUMs. You have two options:
EDIT
So, you changed the question and now you want to create a stored procedure in PostgreSql. You might want to take a look at this: A Basic Introduction to Postgres Stored Procedures. Take your time to read it, the knowledge acquired in the process will surely be helpful. And, on your way through it, you might reevaluate and think you don't really need that kind of functionality for a straightforward query such as this one. Good luck.