select UserID, ProcessDate,Leave=( case when firsthalf = 'PR' and secondhalf = 'PR' then '0' when firsthalf = 'WO' and secondhalf = 'WO' then '0' when firsthalf = 'AB' and secondhalf = 'AB' then '1' when firsthalf is null and secondhalf is null then '1' when firsthalf = 'PR' and secondhalf = 'AB' then '0.5' when firsthalf = 'AB' and secondhalf = 'PR' then '0.5' when firsthalf = 'IN' and secondhalf is null then '0.5' when firsthalf = 'IN' and secondhalf = 'AB' then '0.5' when firsthalf = 'IN' and secondhalf = 'Out' then '0.5' when firsthalf = 'Out' and secondhalf = 'IN' then '0.5' end) ,datename(month,processdate) as Months,datepart(yyyy,processdate) as Years from Accounts_DailyAttendance where UserID=1003 and datename(month,processdate) = 'March' and datepart(yyyy,processdate)= '2014' and firsthalf <> 'PR' and secondhalf <> 'PR' and firsthalf <> 'WO' and secondhalf <> 'WO'
CASE WHEN firsthalf IS NULL AND secondhalf IS NULL then NULL END
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)