select count(*) as cnt from A where d=1 and b=1 ,cnt =1 or 0
...
select count(*) as cnt from A where d=? and b=2 ,cnt =1 or 0
...
select count(*) as cnt from A where d=? and b=3 ,cnt =1 or 0
...
select count(*) as cnt from A where d=? and b=2 ,cnt =1 or 0
...
select count(*) as cnt from A where d=? and b=3 ,cnt =1 or 0
解决方案 »
- 关于物化视图刷新问题!
- oracle如何建立字母开头并且自动增长的主键,如yy00001,yy00002,yy00003,以此类推
- ORACLE中触发器在插入A表后自动修改B表数据么?
- 这样写SQL语句查找每个公司的最新的更新时间
- 问大家一个rman的问题,急,在线等
- 请教##############
- DBLINK与CLOB字段的问题!!急在线等!!!谢谢
- 此效果如何实现(在存储过程中)
- 导入导出时如何保证正确的表顺序?
- 为什么我在另一台机子进OMS时经常会提示:出现异常错误
- 往表A中插入数据,若某条记录满足某个条件,就不将该记录插入表A,而是插入表B,可否实现?
- 为什么从vb中写sql语句取timestamp类型的值时,取不出来
比如:b c d
1 2 3
3 2 0
....
希望得到的结果:
....
1 11 1
2 41 1
3 55 1
4 8888 1
5 9 1
1 131 2
2 411 2
3 525 2
4 8838 2
5 93 2hope:
select XXX where d = 1 and b between 1 and 4;
result:
1 11 2 41 3 55 4 8888我希望知道XXX该如何写,多谢!
sum(decode(b,2,2,0)),sum(decode(b,2,c,0)),
sum(decode(b,3,3,0)),sum(decode(b,3,c,0)),
sum(decode(b,4,4,0)),sum(decode(b,4,c,0))
from you_table where d=1 and b between 1 and 4;