I have a problem with the code below and I cannot see what is wrong with it. It compiles but the results are not what they should be.
select week_no,dept_code,count(*) as 'total registers', count(absence_code) as 'registers marked',
cast(((count(absence_code) / count(*) ) * 100) as decimal (10,2)) as '% marked',
((count(*))- (count(absence_code))) as 'registers not marked',
cast(((((count(*))- (count(absence_code))) / count(*) ) * 100) as decimal (10,2)) as '% not marked'
I have total registers, then registers marked, % marked registers, registers not marked and percentage not marked.
The two percentage fields are not working unless the results is 100% if not the answer shown is 0.00
Can anyone see what I am doing wrong thanks