title: MySQL Data Statistics
body: <p>So, we have a table that basically includes most of the ticket details of a ticket, except for  stuff that is horribly long (like notes, tech notes, pictures, etc), those are linked elsewhere in other tables, etc.</p>
  
  <p>We want to return metrics about the various tickets in the data table.  For example:</p>
  
  <pre><code>SELECT Category, Count(Category) FROM tickets 
  WHERE Date_SUB(CURDATE(), Interval 16 Hour) &lt;= Datez GROUP BY Category
  </code></pre>
  
  <p>Which would return a result listing, for example, each of our categories, and their counts.</p>
  
  <p>However, if we want to adjust this for various intervals, like return the numbers for say <code>16 hours</code>, <code>1 day</code>, <code>30 day</code>, <code>3 month</code>, <code>12 month</code> and <code>All time</code>, are we going to have to run that same query that # of times (like for each of those listed minus all time, run that query 5 times?</p>
  
  <p>Ultimately, we want to use the counts in a dashboard of some sort in our C# Winforms application, that will show us various ticket data, so we can see how the department is doing; but, if we have to sit there and run say 5 queries every few minutes, that can tend to bog down the system no?</p>