Avatar of maqskywalker
maqskywalker

asked on 

T-sql get count of records by date

I'm using SQL Server 2019.


I'm using the Northwind Sample Microsoft Database 


So I'm using the Orders table which looks like this:


SELECT [OrderID]
      ,[CustomerID]
      ,[EmployeeID]       ,[OrderDate]       ,[RequiredDate]       ,[ShippedDate]       ,[ShipVia]       ,[Freight]       ,[ShipName]       ,[ShipAddress]       ,[ShipCity]       ,[ShipRegion]       ,[ShipPostalCode]       ,[ShipCountry]   FROM [Northwind].[dbo].[Orders] ORDER BY [OrderDate]

Open in new window


User generated image



I'm trying to get Count of the order placed each day.


Desired Query Result


So my desired result will be to show the number of orders placed for each date like this  mockup image.


User generated image



On 07/04/1996 only one order was placed.

On 07/05/1996 only one order was placed.

On 07/08/1996 there were 2 orders placed.

..... and so on for every day there was an order placed


What is the best syntax for this result?











SQLMicrosoft SQL ServerMicrosoft

Avatar of undefined
Last Comment
maqskywalker
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of maqskywalker
maqskywalker

ASKER

thanks
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo