---规则2---- /*风险返回码交易*/ /*同一卡号同终端近半小时内,交易笔数澹(含成功及失败)其中任一笔含有风险返回码(扩充后的风险返回码)*/ /*排除以下三种情况*/ /*a.同卡号连续返回码为51且时间跨度在5分钟之内的交易*/ /*b.同卡号连续返回码为55且时间跨度在5分钟之内的交易*/ /*c.同卡号连续返回码为61且时间跨度在5分钟之内的交易*/ select sa_slmt_mcht_id from ( select sa_slmt_mcht_id from tbl_txn_mon1 where tm_rec_crt_time between to_date('2016030300', 'yyyymmddhh24') - 30/24/60 and to_date('2016030400', 'yyyymmddhh24') group by sa_slmt_mcht_id having count(sa_slmt_mcht_id) > 3 ) a where exists( select sa_slmt_mcht_id from tbl_txn_mon1 b where a.sa_slmt_mcht_id=b.sa_slmt_mcht_id and b.sa_rsp_code1 in ('03','04','14','15','21','34','38',