1,617
社区成员
发帖
与我相关
我的任务
分享
create table t_user (id number(5),user_name varchar2(10),birthday date);
insert into t_user values (1,'tom',date'1990-12-24');
insert into t_user values (2,'tom01',date'1990-06-26');
insert into t_user values (3,'tom02',date'1991-03-28');
insert into t_user values (4,'tom03',date'1992-08-14');
commit;
select to_char(birthday,'yyyy') yea,count(id) c_num
from t_user
group by to_char(birthday,'yyyy')
order by to_char(birthday,'yyyy')
yea c_num
----------------------
1 1990 2
2 1991 1
3 1992 1