假如 oracle 数据库 A表中有一个字段B,
B
1,000.11
2,000.22
3,000
4.44现在 我想通过分组查询,将包含","的为一组,包含"."的为一组,查询出其中包含逗号和点号分别多少条的sql怎么写(分组查询)。
B
1,000.11
2,000.22
3,000
4.44现在 我想通过分组查询,将包含","的为一组,包含"."的为一组,查询出其中包含逗号和点号分别多少条的sql怎么写(分组查询)。
解决方案 »
- B-Tree索引与Bitmap索引的锁代价大概是多少?
- 查询oracle9i数据库返回的结果集不能操作!!!!!!!
- oracle+jsp乱码问题
- 求助,在VB6里如何向ORACLE里的XMLTYPE字段写超过4000字节的画面输入的内容
- 发了几天都没人能解决,请好心人帮一下忙
- 求一sql语句,大家帮帮忙
- 请教:怎样清空RBS01.DBF和TEMP01.DBF两文件。
- 初学者的问题,用MFC联接oracle数据库用什么联接好呢?怎么联接?
- 想求Oracle8.1.7,请大虾介绍几个Ftp!
- oracle 查询出数据 计算出比率,想根据比率排序
- ora-01078 求解决。。
- oracle 数据导入
FROM (SELECT (CASE
WHEN INSTR(B, ',') > 0 THEN 1
ELSE NULL
END) AA,
(CASE
WHEN INSTR(B, '.') > 0 THEN 2
ELSE NULL
END) BB
FROM TABLE);
实际上可以更简单select count(case when b like '%,%' then 1 end),
count(case when b like '%.%' then 1 end)
from a;
select '1,000.11' as num from dual union all
select '2,000.22' as num from dual union all
select '3,000' as num from dual union all
select '4.44' as num from dual
)
select count((case when instr(num,',',1,1) != 0 then 1 end)) as c1,count((case when instr(num,',',1,1) = 0 then 1 end)) as c2 from tab
(select '1,000.11' col1 from dual
union all
select '2,000.22' col1 from dual
union all
select '3,000' col1 from dual
union all
select '4.44' col1 from dual)
select count(case when instr(col1,',') > 0 then 1 end),
count(case when instr(col1,'.') > 0 then 1 end)
from a
-----so easy