I hope this is what you are looking for:--Creating TableCreate Table Ex(empno int, date1 Varchar(30) )--Inserting Sample Data Insert into ExSelect 10, '2012-Apr-10'Union ALLSelect 11, '2012-Apr-20'Union ALLSelect 12, '2012-Apr-25'Union ALLSelect 13, '2012-May-02'Union ALLSelect 14, '2012-May-04'Union ALLSelect 15, '2012-May-06'Union ALLSelect 16, '2012-May-08'Union ALLSelect 17, '2012-May-10'Union ALLSelect 18, '2012-May-10'--Query For Your requirementSelect Distinct SUBSTRING(date1, CHARINDEX('-', Date1) + 1, 3) +':'+ Cast(Count(empno) Over (Partition By DatePart(MM,date1) ) As Varchar(30) )As EmployeeCount From Ex
A few things:1. Date should be stored As Date and not a String.2. If this is not what you are looking for then please elaborate on what the requirement is.N 28° 33' 11.93148"E 77° 14' 33.66384"