title: Run PostgreSQL UPDATE query for every object in array
body: <p>Let's say I have a cart of grocery items and each item has a unique ID. When someone clicks "purchase", an array is sent with an object for each item in that cart. The cart varies so sometimes it might be 2 items and sometimes 6 items, etc. </p>
  
  <p>Example:</p>
  
  <pre><code>[{id: 1, amt_purchased: 3}, {id: 2, amt_purchased: 4}]
  </code></pre>
  
  <p>I need my SQL table, "grocery items available", to update according to what was purchased.</p>
  
  <p>For one grocery item, I would use the following:</p>
  
  <pre><code>UPDATE available 
  SET amt_avail = amt_avail - 3
  WHERE produce_id = 1
  </code></pre>
  
  <p>Since I have multiple items now, how can I get the query to run for each item that was purchased? Or as one massive query that will adapt according to how many items were purchased?</p>
  
  <p>My project is Ionic/AngularJs and NodeJs, Express, MassiveJs.</p>
  
  <p>Thanks guys! Still a noob so I'm having a hard time explaining what I need.</p>