查询规则是什么?为什么C的age为空?
解决方案 »
- 跪求CNOUG的邀请码
- 新手,求助
- 求一条SQl语句????????
- 有没有实现把空字符自动变为0的oracle函数???急~~~~~~~~
- 关于 并发 ,请问大家。。。
- plsql运行下面的procedure时,当取出一张卡想显示当前处理的motoristid,该怎么修改?记得sql中用print
- 为何触发器无法创建?
- 奇怪!用存储过程导入数据完了后报错!但数据已导入表中?
- 怎样使用temp设备!!!!!!!!!!!!!!!!!!!!!
- 66、ORACLE中当一个用户正在操作一个执行过程,管理员此时取消了他的权限,会发生什么事情?
- oracle删除check约束
- oracle 更新 表数据 报sqlcode=1403
select name, decode(count(*), 2, 1, 1, null, null) age from tablename group by name;
select name, sum(age) age from tablename group by name;
with test as(
select 'a' name,'1' age from dual union all
select 'a','' from dual union all
select 'b','1' from dual union all
select 'b','' from dual union all
select 'c','1' from dual)
select name,max(age),um(age) from test group by name
查询前
code name
001
001 张三
002 李四
002
003 查询后
code name
001 张三
002 李四
003
(select '001' code, '' name from dual
union all
select '001', '张三' from dual
union all
select '002', '李四' from dual
union all
select '002', '' from dual
union all
select '003', '' from dual)
select code, max(name) from t group by code order by code你不就是上面的意思么
SELECT 'a' name ,'' age from dual union all
SELECT 'a' ,'1' from dual union all
SELECT 'b' ,'1' from dual union all
SELECT 'b' ,'' from dual union all
SELECT 'c' ,'1' from dual
) SELECT * FROM TABLE1 A where A.AGE=(SELECT MAX(AGE) FROM TABLE1 B)
楼主要的是这种?
select name, sum(age) age from tablename group by name;null值参与计算的时候,结果是null
WITH TABLE1 AS(
SELECT 'a' name ,'' age from dual
union all SELECT 'a' ,'1' from dual
union all SELECT 'b' ,'1' from dual
union all SELECT 'b' ,'' from dual
union all SELECT 'c' ,'1' from dual)
select name,max(age) from TABLE1 A group by name;