title: How to sum rows that are between two "type" values?
body: <p>I have some basic knowledge with PHP+MySQL, but I was wondering if such a function can be done.  If so, how should I go about implementing this?  Any advice will be appreciated!</p>
  
  <p>Below is a table of the data:</p>
  
  <pre><code>id |   description         |   amount  |   type   |
  ---+-----------------------+-----------+----------+
  1      FISH BURGER MEAL        NULL        HEADER
  2      Burger                  5.40        ITEM
  3      Fries (S)               2.20        ITEM
  4      Cola (S)                2.00        ITEM
  5      SUBTOTAL                ????        SUBTOTAL
  </code></pre>
  
  <p>So the question is:<br>
  How can I go about doing a <code>SUM(amount)</code> of all <code>type == "ITEMS" WHERE between a "HEADER" type and a "SUBTOTAL" type?</code></p>
  
  <p>The function should return the value of <code>9.60</code> in this case.</p>
  
  <p>Thanks! </p>