title: Query to find records between specific time period
body: <p>I am trying to write a SQL query to get data between specific time period. I want to select data between 23:00 to 03:00 in every day from 2019-11-01 to 2019-12-01. </p>
  
  <p>I wrote a query like below,</p>
  
  <pre><code>SELECT 
      DATEPART(DAY, EnteredDate) AS PerDate,
      COUNT(Item) AS ItemCount,
      ItemCategory
  FROM 
      MyTable
  WHERE 
      EnteredDate BETWEEN '2019-11-01' AND '2012-12-01' AND 
      CAST(EnteredDate AS TIME) BETWEEN '23:00:00' and '03:00:00'
  GROUP BY 
      DATEPART(EnteredDate), ItemCategory
  ORDER BY 
      DATEPART(DAY, EnteredDate)
  </code></pre>
  
  <p>Can anyone please help me for some query which I can use?</p>