select decode(to_char(datefield-1,'yyyy-mm-d'),0,'上旬',1,'中旬','下旬'),count(*) from mytable group by decode(to_char(datefield-1,'yyyy-mm-d'),0,'上旬',1,'中旬','下旬')
select to_char(datefield,'yyyy'),
to_char(datefield,'mm'),
decode(trunc((to_char(datefield,'dd')-1)/10),0,'上旬',1,'中旬','下旬'),
count(*)
from mytable
group by to_char(datefield,'yyyy'),
to_char(datefield,'mm'),
decode(trunc((to_char(datefield,'dd')-1)/10),0,'上旬',1,'中旬','下旬');
select to_char(datefield,'yyyy-mm-dd'),count(*) from mytable group by
to_char(datefield,'yyyy'), to_char(datefield,'mm'), decode(trunc(to_char(datefield,'dd')-1/10),0,'上旬',1,'中旬','下旬');