title: how to deal with error 1064?
body: <p>i am trying to write a sql query which outputs the identification number of the product(p_id), as well as the quantity sold in the last year(2016) and the dollar amount generated.</p>
  
  <p>following is my code</p>
  
  <pre><code>mysql&gt; select id,
      -&gt; sum(quantity) as Quantity_Sold
      -&gt; sum(amt_paid) as Purchase
      -&gt; from transaction
      -&gt; where order_date like '%2016%'
      -&gt; group by p_id;
  </code></pre>
  
  <p>following is the table i am trying to query form</p>
  
  <pre><code>select * from transaction;
  +------+------+------+------------+---------------+----------+------+----------+
  | T_ID | P_ID | ID   | ORDER_DATE | DELIVERY_DATE | QUANTITY | SP   | AMT_PAID |
  +------+------+------+------------+---------------+----------+------+----------+
  | T1   | P1   | C2   | 2001-01-16 | 2001-02-01    |        2 |  100 |      200 |
  | T10  | P11  | C11  | 2001-06-13 | 2001-06-20    |        3 |   25 |       75 |
  | T100 | P11  | C11  | 2004-12-06 | 2004-12-11    |        6 |   25 |      150 |
  | T101 | P6   | C3   | 2005-01-07 | 2005-01-12    |        1 |   35 |       35 |
  | T102 | P3   | C4   | 2005-01-11 | 2005-01-16    |        4 |  120 |      480 |
  | T103 | P12  | C5   | 2005-01-26 | 2005-01-31    |        3 |   90 |      270 |
  </code></pre>
  
  <p>it gives the following error
  ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'sum(quantity) as quantity
  sum(amt_paid) as purchase
  where order_date like '%2016' at line 2</p>
  
  <pre><code>enter code here
  </code></pre>