select t1.name,
t1.phone,
sum(decode(t2.send_status, 0, 1, 0)) 通知中,
sum(decode(t2.send_status, 1, 1, 0)) 通知成功,
sum(decode(t2.send_status, 2, 1, 0)) 通知失败,
sum(1) 通知总次数
from USERINFO t1, tempdial t2
where t1.phone = t2.telno
group by t1.name, t1.phone
t1.phone,
sum(decode(t2.send_status, 0, 1, 0)) 通知中,
sum(decode(t2.send_status, 1, 1, 0)) 通知成功,
sum(decode(t2.send_status, 2, 1, 0)) 通知失败,
sum(1) 通知总次数
from USERINFO t1, tempdial t2
where t1.phone = t2.telno
group by t1.name, t1.phone
解决方案 »
- Io 异常: The Network Adapter could not establish the connection
- 请教个sql语句,或者给个思路也行?
- Oracle10g 报ORA-12514:TNS:listenendoes not currently know of
- 关于一个数据查询的问题
- 联合主键的sql语句写法
- 如何选择时间段查询数据
- 我在安装oracle9i后一切正常,能通过delphi(BDE)连接到oracle,但重新启动时报错啊19011
- 一个SQL语句的问题,请帮忙解答一下
- 能否把一个数据库中的内容导入到另外一个数据库,两者的sid不同.
- ORACLE触发器的简单问题
- 帮忙看一下更新某个字段中部分内容的sql应该怎么写
- 怎么用sql判断1个字段中的记录比指定的字符串少那个?
t1.phone,
sum(decode(t2.send_status, 0, 1, 0)) 通知中,
sum(decode(t2.send_status, 1, 1, 0)) 通知成功,
sum(decode(t2.send_status, 2, 1, 0)) 通知失败,
count(1) 通知总次数
from USERINFO t1, tempdial t2
where t1.phone = t2.telno(+)
group by t1.name, t1.phone
select t1.name,
t1.phone,
count(select t.send_status from tempdial t where send_status='0') ,
count(select t.send_status from tempdial t where send_status='1') ,
count(select t.send_status from tempdial t where send_status='2') ,
count(select t.send_status from tempdial t )
from userinfo t1,tempdial t2
where t1.phone=t2.telno
t1.phone,
sum(decode(t2.send_status, 0, 1, 0)) 通知中,
sum(decode(t2.send_status, 1, 1, 0)) 通知成功,
sum(decode(t2.send_status, 2, 1, 0)) 通知失败,
count(1) 通知总次数
from USERINFO t1 left join tempdial t2
on t1.phone = t2.telno
group by t1.name, t1.phone