Assume that you have a Order table and you want to query the table to retreive the total orders made each day. You can do this by using the GROUP BY with the Datetime fields being type casted to date as shown below.
How to Group By datetime and ignore time in SQL Server ?
SELECT CAST(OrderDateTime AS DATE) as OrderDate, COUNT(1) as TotalOrders FROM Orders GROUP BY CAST(OrderDateTime AS DATE)
Enter your email address to subscribe to this blog and receive notifications of new posts by email.