title: Why Is This ')' causing an error?
body: <p>I want to create a stored procedure <code>spSumInvoices</code> that will take in the vendor id of interest and print out the vendor’s name and the sum of all their invoices. </p>
  
  <p>This is the code I am using, not sure if its right I'm new to stored procedures:</p>
  
  <pre><code>IF OBJECT_ID ('spSumInvoices') IS NOT NULL
      DROP PROC spSumInvoices;
  GO
  
  CREATE PROC spSumInvoices
      @FindVen int,
      @InvoiceTotal Money,
      @VenName VARCHAR
  AS
  BEGIN  
      SELECT 
          @FindVen, SUM(InvoiceTotal) AS 'Total', @VenName
      FROM 
          Vendors,Invoices
      WHERE 
          Invoices.VendorID = @FindVen
      GROUP BY 
          @InvoiceTotal
  END
  
  PRINT 'Vendor' + @VenName
  PRINT 'Has an invoice total of $' + CONVERT(VARCHAR,@InvoiceTotal);
  </code></pre>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Msg 164, Level 15, State 1, Procedure spSumInvoices, Line 15<br>
    Each GROUP BY expression must contain at least one column that is not an outer reference.</p>
  </blockquote>