Select top 100
a.ContractSupplier
from Org a,Employee b,Providers c
where a.OrgID = b.OrgID and
a.ContractSupplier = c.CName and c.IsUse = '01' and b.EmpID=965623
其中
ORG表ORgID 主键
employee表employeeId主键
Providers 表没有用上主键和索引
a.ContractSupplier
from Org a,Employee b,Providers c
where a.OrgID = b.OrgID and
a.ContractSupplier = c.CName and c.IsUse = '01' and b.EmpID=965623
其中
ORG表ORgID 主键
employee表employeeId主键
Providers 表没有用上主键和索引
Select top 100
a.ContractSupplier
from Org a,Employee b,Providers c
inner join Employee b on b.EmpID=965623
and a.OrgID = b.OrgID
inner join Providers c on c.IsUse = '01'
and a.ContractSupplier = c.CName避免生成笛卡尔积,用表关联尽可能在初期就减少选区数据集和
c.CName
c.IsUse
b.EmpID都可以考虑索引,关键看你表的数据分布情况,重复率很重要还有就是每个表都要有个主键可以提高索引使用率。