我的表里有一个生日字段, 我想用一个语句求出,小于12个月的人数和所有生日不为空的人数,请问该怎么写呢?
解决方案 »
- oracle函数返回long raw类型的时候,貌似有长度限制,100K以上会被截断!
- 急求linux9.0下oracle10的安装文件!!
- oracle数据库的用户口令密文放在什么地方?
- 救命: can bind a LONG value only for insert into a LONG column
- oracle 出现符号 "WHILE"在需要下列之一时::= . ( @ % ; not null range default character
- 菜鸟学习
- Oracle ,请问各位大侠,oracle9i,怎么升级到oracle9.2i
- oracle 10g企业管理器启动问题
- 请教:关于利用一个表更新第二个表格的方法问题
- 奇怪为什么这样不行?sql语句出错
- 别名的问题,求救
- 求一sql语句!~~!~
where t.birthday is not null
and t.birthday<add_months(sysdate,-12)
from tab
where date is not null
or
date < add_months(to_date(TO_CHAR(TRUNC(DATE), 'YYYY') || '01-01', 'yyyy-mm-dd'), 11)
to Eric_1999(╙@^@╜) :
我要得到 用一个sql语句求出 生日小于12个月的 人数 和 全部人数
不是要列出记录列表
类似于这个,我觉得他太麻烦了
select d ,x from (
select
(select count(*) from aa where birthdat is not null) d
(select count(*) from aa where and months_between(sysdate, birthdat ) < 12) x
from dual
)我知道肯定有简单的写法的,帮帮忙了
select *
from
(select count(*) from aa where birthdat is not null),
(select count(*) from aa where and months_between(sysdate, birthdat ) < 12)
union all
select count(*) from aa where and months_between(sysdate, birthdat ) < 12
再简单的不好找啦