I'm working on creating a chart for my client and they want to get the total customer count over a 24 hour, 3 day, 1 week, 1 month, etc period. I'm honestly not the best with SQL, so generating these queries aren't my forte.
In regards to getting the customers over 24 hours, I've come across two "where" statements that may work, but I'm not sure which is the best.
First version: WHERE DATEDIFF(hh,CreatedDate,GETDATE())>24
Second Version: WHERE CreatedDate >= DATEADD(HH, -24, GETDATE())
The first version generates 21 rows and the second generates 17 rows (from the same dataset, of course) so obviously one is more accurate than the other. I'm leaning towards the first, but I would like your opinion... please.
Thanks, Andrew