title: Count days between two dates, excluding weekends (MySQL only)
body: <p>I need to calculate the difference (in days) between two dates in MySQL excluding weekends (Saturday and Sunday). That is, the difference in days minus the number of Saturday and Sunday in between.</p>
  
  <p>At the moment, I simply count the days using:</p>
  
  <pre><code>SELECT DATEDIFF('2012-03-18', '2012-03-01')
  </code></pre>
  
  <p>This return <code>17</code>, but I want to exclude weekends, so I want <code>12</code> (because the 3rd and 4th, 10th and 11th and 17th are weekends days).</p>
  
  <p>I do not know where to start. I know about the <code>WEEKDAY()</code> function and all related ones, but I do not know how to use them in this context.</p>