title: Fastest way to add data: MySQL or JavaScript?
body: <p>My goal is to get the sum of data the fastest way possible, whether that is done in a MySQL query or when processing it in JavaScript after I get the data. Here is my query:</p>
  
  <pre><code>SELECT COUNT(*) total,
      SUM(ICCID1State = '14' AND ICCID1Carrier = '0' OR ICCID2State = '14' AND ICCID2Carrier = '0') 'AT&amp;T Activated',
      SUM(ICCID1State = '15' AND ICCID1Carrier = '0' OR ICCID2State = '15' AND ICCID2Carrier = '0') 'AT&amp;T Not Activated',
      SUM(ICCID1Carrier = 0 OR ICCID2Carrier = 0) 'AT&amp;T Total',
      SUM(ICCID1State = '14' AND ICCID1Carrier = '1' OR ICCID2State = '14' AND ICCID2Carrier = '1') 'Verizon Activated',
      SUM(ICCID1State = '15' AND ICCID1Carrier = '1' OR ICCID2State = '15' AND ICCID2Carrier = '1') 'Verizon Not Activated',
      SUM(ICCID1Carrier = 1 OR ICCID2Carrier = 1) 'Verizon Total'
  FROM myTable
  WHERE DealerKey = ?
  </code></pre>
  
  <p>Would that be faster than just fetching all the data and then adding it using JavaScript?</p>