Sql语句执行优化
selectnvl(t1.id,nvl(t2.id,t3.id))asid,nvl(t1.name,nvl(t2.name,t3.name))asname,t1.valu...
select nvl(t1.id, nvl(t2.id, t3.id)) as id,
nvl(t1.name, nvl(t2.name, t3.name)) as name,
t1.value as value,
t2.value as parentValue,
t3.value as centerValue,
from
(select id,name,value from Table where tid='123')t1
full join
(select id,name,value from Table where tid='123')t2
on t1.id=t2.id
full join
(select id,name,value from Table where tid='123')t3
on t3.id=t2.id
语句如上所示,请问各位大侠,这样的语句是否在执行时存在效率问题,该如何优化呢?
下面3个select 语句中的 tid的值不同 展开
nvl(t1.name, nvl(t2.name, t3.name)) as name,
t1.value as value,
t2.value as parentValue,
t3.value as centerValue,
from
(select id,name,value from Table where tid='123')t1
full join
(select id,name,value from Table where tid='123')t2
on t1.id=t2.id
full join
(select id,name,value from Table where tid='123')t3
on t3.id=t2.id
语句如上所示,请问各位大侠,这样的语句是否在执行时存在效率问题,该如何优化呢?
下面3个select 语句中的 tid的值不同 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询