title: Use SQL To Filter Table Where I Need to Sum Multiple Rows Of A Column Based On Another Column
body: <p>I'm trying to filter a table, where there are multiple rows for a single member for each store they have purchased items at. Plus columns for number of meat and vegetable items purchased. I want to have a list of people and all the stores where they have purchases meat <em>and</em> vegetables.</p>
  
  <p>Source table: </p>
  
  <p><code>MemberId  |  StoreId  | Meat  |  Vegegetables
     1           11          1         2
     1           12          0         1
     1           14          1         2
     2           12          1         0
     3           12          1         0
     3           12          1         0
     4           11          2         1
     4           13          0         1
     4           14          0         1</code></p>
  
  <p>The filter I want to apply is:</p>
  
  <p>For a MemberId (across all stores): WHERE SUM(Meat) > 0 AND SUM(Vegetables) > 0 </p>
  
  <p>So I'm looking for this results table</p>
  
  <p><code>MemberId  |  StoreId  | Meat  |  Vegetables
     1           11          1         2
     1           12          0         1
     1           14          1         2
     4           11          2         1
     4           13          0         1
     4           14          0         1</code></p>
  
  <p>This has got me stumped and I can't work out how to filter this table.</p>
  
  <p>Thanks</p>