select a.name,a.count1 '优秀' ,b.count2 '合格',c.count3 '不合格' from
(select count(*) count1 from tablename where sysdate < datecol + 3 group by name) a,
(select count(*) count2 from tablename where sysdate >= datecol + 3 and sysdate < datecol +5 group by name) b,
(select count(*) count3 from tablename where sysdate >= datecol + 5 group by name) c
where a.name=b.name and a.name=c.name;
:)比较麻烦!
(select count(*) count1 from tablename where sysdate < datecol + 3 group by name) a,
(select count(*) count2 from tablename where sysdate >= datecol + 3 and sysdate < datecol +5 group by name) b,
(select count(*) count3 from tablename where sysdate >= datecol + 5 group by name) c
where a.name=b.name and a.name=c.name;
:)比较麻烦!
group by name
select name,sum(sign(1-abs(SYSDATE-RECEIVTIEM-4))) 合格, sum(sign(SYSDATE-RECEIVTIEM-5)) 不合格, sum(sign(3-sysdate-receivetime)) ) 优秀 from a
group by name
sum(decode(sign(SYSDATE-RECEIVETIME-3),1,(decode(sign(SYSDATE-RECEIVETIME-5),-1,1,0),0)) as '合格',
sum(decode(sign(SYSDATE-RECEIVETIME-5),1,1,0)) as '不合格'
from tbname
group by name;
select name,sum(decode(sign(1-abs(SYSDATE-RECEIVTIEM-4)),1,1,0)) 合格, sum(decode(sign(SYSDATE-RECEIVTIEM-5),1,1,0)) 不合格, sum(decode(sign(3-sysdate-receivetime),1,1,0)) 优秀 from table
group by name