1) My Table:
Query: select mcdesp,mcopsts from machine
Table:
mcdesp | mcopsts |
A | GOOD |
A | GOOD |
B | GOOD |
C | URWP |
C | GOOD |
A | URWT |
A | URWT |
2) My Quries and their outputs:
select mcdesp,count(mcopsts)as TotalMachine from machine group by mcdesp
select mcdesp, count(mcopsts) as GOOD from machine where mcopsts='GOOD' group by mcdesp
select mcdesp,count(mcopsts) as URWT from machine where mcopsts='URWT' group by mcdesp
select mcdesp,count(mcopsts) as URWP from machine where mcopsts='URWP' group by mcdesp
BUT I NEED A RESULT LIKE
mcdesp | TotalMachine | GOOD | URWP | URWT |
A | 4 | 2 | 0 | 2 |
B | 1 | 1 | 0 | 0 |
C | 2 | 1 | 1 | 0 |
Please some one help me..