Problem with query

1

I have the following problem, I want the column Months to stop repeating, and the column Qty is added, but the table is the result of a query, I leave the query and the result table as an example:

select  DateName(month,date_estimated)as Months,count(date_estimated) as Qty 
from tbl_Crs
where Date_Estimated between (select  dateadd(yy, datediff(yy, 0, getdate()), 
0)) and getdate() 
group by date_estimated

    
asked by CarlosR93 03.11.2017 в 21:14
source

1 answer

1

You have to group by month, not by date:

group by DateName(month,date_estimated)

If you want it in order of month, modify the group by in this way and add the following order by :

group by month(date_estimated), DateName(month,date_estimated)
order by month(date_estimated)
    
answered by 03.11.2017 / 21:20
source