title: MS SQL - Join with group by
body: <p>I'm very new to SQL and learing it from the book "SAMS Teach Yourself SQL in 24 hours". My concern is all about joins and grouping the select output. Here is the structure of my tables:</p>
  
  <pre><code>CREATE TABLE ORDERS_TBL
  ( ORD_NUM VARCHAR(10) NOT NULL primary key,
    CUST_ID VARCHAR(10) NOT NULL,
    PROD_ID VARCHAR(10) NOT NULL,
    QTY INTEGER NOT NULL,
    ORD_DATE DATE );
  
  CREATE TABLE PRODUCTS_TBL
  ( PROD_ID VARCHAR(10) NOT NULL primary key,
    PROD_DESC VARCHAR(40) NOT NULL,
    COST DECIMAL(6,2) NOT NULL );
  </code></pre>
  
  <p>What I would like to achive are join operation which would group by my PROD_ID.</p>
  
  <pre><code>SELECT P.PROD_DESC, SUM(O.QTY)
      FROM PRODUCTS_TBL AS P LEFT JOIN ORDERS_TBL AS O
      ON P.PROD_ID = O.PROD_ID
      GROUP BY P.PROD_ID
      ORDER BY P.PROD_ID;
  </code></pre>
  
  <p>The query above does work for MySQL but not for my MS SQL environment. What does work but is annoying as i don't want to see the PROD_ID in my output.</p>
  
  <pre><code>SELECT P.PROD_ID, P.PROD_DESC, SUM(O.QTY)
      FROM PROCUCTS_TBL AS P LEFT JOIN ORDERS_TBL AS O
      ON P.PROD_ID = O.PROD_ID
      GROUP BY P.PROD_ID, P.PROD_DESC
      ORDER BY P.PROD_ID;
  </code></pre>
  
  <p>Any hints on how to I get an output table with PROD_DESC, the sum of quantity and group by PROD_ID?</p>