5.##根据类型+状态,查询移动成功总数
Sql代码
--根据类型+状态,查询移动成功总数
select sum(decode(t.operators_code,'40',1,0)*decode(t.state,'0',1,0)) yidongNum
from t_phone_sale t--40为移动
6.时间倒序、type_num正序排列结果集
Sql代码
--时间倒序、type_num正序排列结果集
select * from t_commission t order by t.create_date desc,t.type_num desc
select * from t_commission t order by t.create_date desc,t.type_num asc
7.在线充值,业务查询,增加统计项
--前台:在线充值,业务查询,
--增加统计项(业务总数,成功业务总数,总资金数,成功业务资金数,佣金合计)
--sql为:
select count(*) as recordTotal,nvl(sum(decode(t1.state,'0',1,0)),0) as successTotal,
nvl(sum(t1.money),0) as moneyTotal,
nvl(sum(decode(t1.state,'0',t1.money,0)),0) as successMoneyTotal,
nvl(sum(decode(t1.state,'0',t1.commission,0)),0) as commissionTotal
from T_PHONE_SALE t1 where 1=1 and t1.state='0' and t1.bussiness_id='15104667195'
and t1.create_date>=to_date('2011-07-27 11:49','yyyy-MM-dd HH24:MI')
and t1.create_date<=to_date('2011-08-26 23:59','yyyy-MM-dd HH24:MI');
8.Oracle查询前10条记录
Sql代码
select * from t_product_type where rownum <=10
作者“Only the heart peace will be prosperity”