马背上的风 2015-08-06 10:05
浏览 887

oracle数据库高手帮忙改下SQL

以上SQL的子查询太多,存在子查询的结果返回多个结果的情况,报ora-01427错误,现在要把所有子查询的语句都改为left join 形式,请高手帮忙修改下

select * from (select rownum as 序号, x.*
from (select distinct mm.main_id as 编号,
mm.sheet_id as 工单流水号,
mm.cs_sheet_id as 客服工单流水号,
mm.complaint_num as 投诉用户号码,
to_char(mm.build_time,
'yyyy-MM-dd hh24:mi:ss') as 客服接单时间,
(select dictname
from taw_system_dicttype
where dictid = mm.region_id) as 故障地市,
(select dictname
from taw_system_dicttype
where dictid = mm.network_field) as 投诉网络,
mm.indoor as 投诉环境,
mm.complaint_place as 投诉地点,
mm.longitude as 经度,
mm.latitude as 纬度,
(select dictname
from taw_system_dicttype
where dictid = mm.business_type) as 业务类别,
mm.user_package as 用户套餐,
(select dictname
from taw_system_dicttype
where dictid = mm.complaint_phenomenon) as 投诉现象,
mm.complaint_content as 投诉内容,
(select tl.first_deal_advice
from ws_customercomplaint_link tl
where tl.main_id = mm.main_id
and tl.status = '初步回复'
and tl.activity_def_id = 'DealActivity'
and tl.to_activity_def_id =
'DraftActivity') as 初步处理意见,
(select tl.final_deal_advice
from ws_customercomplaint_link tl
where tl.main_id = mm.main_id
and tl.status = '解决回复'
and tl.activity_def_id = 'DealActivity'
and tl.to_activity_def_id = 'HoldActivity') as 最终处理意见,
'' as 问题原因定位,
(select dictname
from taw_system_dicttype
where dictid = mm.final_dept) as 最终责任部门,
'' as 投诉是否解决,
'' as 投诉区域属性,
mm.sheet_deal_person as 客服前台工单处理人,
'' as 所属网格
from ws_customercomplaint_main mm
where mm.send_time >=
TO_DATE('2015/7/5 0:00:00', 'yyyy-MM-dd hh24:mi:ss')
and mm.send_time <
TO_DATE('2015/8/5 0:00:00', 'yyyy-MM-dd hh24:mi:ss')) x
where rownum <= (99 + 1))
where 序号 >= (0 + 1)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办