title: t-SQL Grouping by Day and Hours
body: <p>I need to determine the number of sales for the week and weekend but the weekend is to be counted as between 6pm Friday and 9am Monday.</p>
  
  <p>For instance, if I have the below data:</p>
  
  <pre><code>2017-02-09 14:00
  2017-02-09 19:00
  2017-02-10 17:15
  2017-02-10 18:22
  2017-02-11 11:00
  2017-02-11 16:00
  2017-02-12 19:30
  2017-02-13 08:00
  2017-02-14 14:00
  </code></pre>
  
  <p>I would get the following:</p>
  
  <pre><code>Weekday: 4
  Weekend: 5
  </code></pre>
  
  <p>Its fairly easy to get the sales per day using something like:</p>
  
  <pre><code>select count(*) as total, dateadd(DAY,0, datediff(day,0, created) as created
  from sales
  group by dateadd(DAY,0, datediff(day,0, created))
  </code></pre>
  
  <p>But I cant think how to combine the hours and days to get the information I require.</p>