question

Jaswant avatar image
Jaswant asked

How to Find summery of event in sql server

CREATE TABLE [dbo].[test](

[dates] [datetime] NULL,

[status] [varchar](14) NOT NULL

) ON [PRIMARY]

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:48.313' AS DateTime), N'Ideal')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:09.313' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:27.330' AS DateTime), N'Ideal')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:48.313' AS DateTime), N'Ideal')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:10.017' AS DateTime), N'Ideal')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:01:19.367' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:01:03.347' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:48.313' AS DateTime), N'Ideal')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:09.313' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:45.323' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:01:03.347' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:00:48.313' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:01:18.410' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:01:19.367' AS DateTime), N'Stopped')

GO

INSERT [dbo].[test] ([dates], [status]) VALUES (CAST(N'2021-10-01T00:01:03.347' AS DateTime), N'Stopped')

GO


Current table date


1.png


Summery report will look like


2.png



plz help

sqlserver2012sql2008
1.png (14.8 KiB)
2.png (11.0 KiB)
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Moden avatar image Jeff Moden commented ·
What version of SQL Server are you using?
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.