Пожалуйста, попробуйте это.
SELECT DATEPART(year,l_date) as [year], count(l_date) as counts
from am_history
group by DATEPART(year,l_date);
Пример: ---
Declare @tbl Table(
id INT ,
[group] Varchar(50),
value varchar(50),
Dat DATETIME
)
INSERT INTO @tbl VALUES(1,'1.1.03.01.00.00',NULL,GETUTCDATE()-100)
INSERT INTO @tbl VALUES(2,'1.1.03.01.01.00',NULL,GETUTCDATE() + 7)
INSERT INTO @tbl VALUES(3,'1.1.03.01.02.00',NULL,GETUTCDATE()+10)
SELECT DATEPART(year,Dat)As years,count(Dat) as counts FROM @tbl group by DATEPART(year,Dat)