原SQL 构建如下:
select * from table1 t1,table2 t2
where t1.pid=t2.id
and (条件1 or 条件2 or 条件3)
and (条件4 or 条件5 or 条件6).....
这种该怎么优化好,提供一个思路即可。多谢!
select * from table1 t1,table2 t2
where t1.pid=t2.id
and (条件1 or 条件2 or 条件3)
and (条件4 or 条件5 or 条件6).....
这种该怎么优化好,提供一个思路即可。多谢!
解决方案 »
- 如何通过一句SQL语句,返回一个布尔值?
- 求SQL
- 有没有人做过smallfile,bigfile,asm的性能比对,共享下测试结果,谢谢!
- 有讲解pl sql的视频地址没
- 高分求救:用imp导入数据库出现kgepop: no error frame to pop to for error 21500
- 怎样获取System.Data.OracleClient.dll源码
- 解析XML文件的Oracle存储过程的问题
- oracle中的sql语句问题(急!!!!!!!!!)
- oracle酷站推荐这里领分hdkkk(diablo2) [50]alonepb(pb) [10]wanghai(汪海) [40]
- 客户机不能连接到服务器,救命
- 偶是菜鸟,看看这个关联删除的sql能不能优化一下?
- 动态SQL能执行,非动态SQL执行不了??
select count(*) into returnValue from dual
where exists (
select 1 from ViewForPurviewOut a where a.resourceid = FAULT_OPERATION_RESOURCE_ID
and ((not exists (select 1 from ViewForPurview b
where b.configid = a.pdcguid and b.attrid = '5' and b.attrexpre = 0 and b.guid = pProductID)
and exists (select 1 from cc_purview_datarange c where c.configid = a.pdcguid and c.attrid = '5' and c.attrexpre = 0)) /* 不包含产品范围 */
or exists (select 1 from ViewForPurview b
where b.configid = a.pdcguid and b.attrid = '5' and b.attrexpre = 1 and b.guid = pProductID)) /* 包含产品范围 */
and ((not exists (select 1 from ViewForPurview b
where b.configid = a.pdcguid and b.attrid = '1' and b.attrexpre = 0 and b.guid = pAreaID)
and exists (select 1 from cc_purview_datarange c where c.configid = a.pdcguid and c.attrid = '1' and c.attrexpre = 0)) /* 不包含地理范围 */
or exists (select 1 from ViewForPurview b
where b.configid = a.pdcguid and b.attrid = '1' and b.attrexpre = 1 and b.guid = pAreaID)) /* 包含地理范围 */
and ((not exists (select 1 from ViewForPurview b
where b.configid = a.pdcguid and b.attrid = '6' and b.attrexpre = 0 and b.guid = pCustomerID)
and exists (select 1 from cc_purview_datarange c where c.configid = a.pdcguid and c.attrid = '6' and c.attrexpre = 0))/* 不包含客户范围 */
or exists (select 1 from ViewForPurview b
where b.configid = a.pdcguid and b.attrid = '6' and b.attrexpre = 1 and b.guid = pCustomerID)) /* 包含客户范围 */
and exists (select 1 from cc_purview_operole por
join cc_base_roleope ro on por.roleid = ro.roleid
where ro.opeid = pOpUnitID and por.operange = a.poguid) /* 包含操作项 */
and a.typeid = 20 and a.userid = pUserID);