title: performing multiple separate sums with separate filters on a table
body: <p>I have a table with an amount column a reference field and an id column. What I need to do is sum the amount based on different combinations of ID's for each reference. There are nine different combinations in total that I then need to insert into a separate table. </p>
  
  <p>The best way I've found to do this is to use a cursor and do each SUM separately, assign the amount to a variable and update the table for each reference and for each combination. </p>
  
  <p>Hope that makes sense! </p>
  
  <p>What I was hoping to find out is - is there a better way to do it? </p>
  
  <p>thanks. </p>