0 votes
1 view
in SQL by (20.3k points)

Like when I do

SELECT [Date]

  FROM [FRIIB].[dbo].[ArchiveAnalog]

  GROUP BY [Date]

how can I specify the group period?

MS SQL 2008

2nd Edit

I'm trying

SELECT MIN([Date]) AS Rect, AVG(Value)

  FROM [FRIIB].[dbo].[ArchiveAnalog]

  GROUP BY (DATEPART(MINUTE, [Date]) / 10)

  ORDER BY RecT

changed %10 to / 10. is it possible to make Date output without milliseconds?

1 Answer

0 votes
by (40.4k points)

You can use the below code:

GROUP BY

DATEPART(YEAR, DT.[Date]),

DATEPART(MONTH, DT.[Date]),

DATEPART(DAY, DT.[Date]),

DATEPART(HOUR, DT.[Date]),

(DATEPART(MINUTE, DT.[Date]) / 10)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...