title: using CAST to remove time from getdate to get results from last 7 days FROM yesterday
body: <p>i am using this statement</p>
  
  <pre><code>SELECT     TOP (100) PERCENT CONVERT(varchar(255), [Reg Date1], 103) AS [Reg Date], Regs
  FROM         (SELECT     CONVERT(datetime, CONVERT(varchar(255), SetupDateTime, 101)) AS [Reg Date1], COUNT(DISTINCT ID) AS Regs
                         FROM          dbo.tbl_User
  WHERE SetupDateTime
  BETWEEN (DATEADD (dd , -7 , GETDATE())) AND (DATEADD (dd , -1 , GETDATE()))
  GROUP BY CONVERT(datetime, CONVERT(varchar(255), SetupDateTime, 101))) AS tb
  ORDER BY CONVERT(datetime, [Reg Date1])
  </code></pre>
  
  <p>which works perfectl;y and gets the last 7 days from yesterday.</p>
  
  <p>However it gets the results from this time yesterday but i want it to get all of the results from yesterday so i know im to use a cast .....</p>
  
  <p>CAST(FLOOR( CAST( GETDATE() AS FLOAT ) )AS DATETIME)</p>
  
  <p>but i cant seem to get it to work alongside this query.</p>
  
  <p>any help?</p>