I am trying to calculate the total hours worked by each employee per month.

Following is the code which i used: 

```
SELECT 
    emp_name, 
    emp_id, 
    monthval = DATENAME( month, Pdate), 
    Total_Time = (CAST(SUM(DATEDIFF(MI, In_Punch, Out_Punch))/60 as varchar)            
           + ':' +  right('00'+ cast(SUM(DATEDIFF(MI, In_Punch, Out_Punch))%60 as varchar), 2)) 
FROM masterprocessdailydata 
WHERE Emp_Id = @EmpID 
GROUP BYEmp_Name,Emp_ID, DATENAME(month, Pdate)

```

It working fine apart from that the order of month shown is different.

This query orders the columns alphabetic wise. 

**Output:** 

```
April, December, February, January,July and so on...

```

**Expected Output:** 

```
January, February, March...

```

Since i want the month name as output, i cant use - **DATEPART(month, Pdate)**.

Is there a way to convert *monthname* to *monthvalue*, just for grouping purpose?
Or will i have to change the query completely?