title: group by CONVERT(VARCHAR(10), dateTrade, 111) not working
body: <p>I want  average values every 15 minutes ordered by DateTime without time. I have the Group by this Date but it is not working</p>
  
  <p>I used an example I found at stackoverflow</p>
  
  <pre><code>declare @interval int = 15
  select  CONVERT(VARCHAR(10), dateTrade, 111) as dateo,
  dateadd(MINUTE, DATEDIFF(MINUTE, '01-jan-1970', DateTrade)/@interval*@interval, '01-jan-1970') as d,
          avg(price) as Av,
          avg(Volume) as Mn
  
  FROM     [crypto].[dbo].[TradesOutros]
  WHERE   MOEDA = 'XBTEUR' 
  group by  CONVERT(VARCHAR(10), dateTrade, 111), 
            DATEDIFF(MINUTE, '01-jan-1970', DateTrade)/@interval
  
  2019/07/21  2019-07-21 01:15:00.000 9618.55882352941    0
  2019/07/21  2019-07-21 06:15:00.000 9495.1975   0
  2019/07/20  2019-07-20 16:00:00.000 9450.4  0
  2019/07/21  2019-07-21 00:45:00.000 9584.55702479338    0
  2019/07/20  2019-07-20 01:45:00.000 9357.92093023256    0
  2019/07/20  2019-07-20 12:30:00.000 9358.6125   0
  2019/07/20  2019-07-20 01:00:00.000 9400.625    0
  2019/07/21  2019-07-21 01:30:00.000 9641.80862068965    0
  2019/07/19  2019-07-19 13:45:00.000 9379.46498054474    0
  2019/07/20  2019-07-20 11:45:00.000 9450.77111111111    0
  2019/07/20  2019-07-20 17:30:00.000 9528.33571428571    0
  2019/07/21  2019-07-21 06:30:00.000 9471.74 0
  2019/07/19  2019-07-19 23:00:00.000 9430.88153846153    0
  2019/07/21  2019-07-21 02:15:00.000 9653.6696969697 0
  2019/07/20  2019-07-20 11:00:00.000 9436.05131578947    0
  2019/07/20  2019-07-20 16:45:00.000 9479.03936170213    0
  2019/07/19  2019-07-19 13:00:00.000 9328.71529902643    0
  2019/07/19  2019-07-19 23:45:00.000 9347.04615384615    0
  2019/07/21  2019-07-21 07:15:00.000 9476.14444444445    0
  2019/07/20  2019-07-20 10:15:00.000 9465.43484848485    0
  2019/07/21  2019-07-21 05:00:00.000 9472.26461538461    0
  2019/07/20  2019-07-20 15:15:00.000 9434.18101265823    0
  2019/07/18  2019-07-18 23:15:00.000 9377.66666666667    0
  2019/07/21  2019-07-21 05:45:00.000 9511.025    0
  2019/07/19  2019-07-19 10:45:00.000 9229.85 0
  </code></pre>