一个有关SQL的执行效率的问题
云中客 2006-01-21 08:44:05
有两段SQL的语句,在本地机上运行,哪段语句执行速度和效率更高
1.select * from table1 where cost between (select max(cost) from table2) and (select max(cost)*1.25 from table2)
2
declare @s_max int
declare @l_max int
select @s_max=max(cost) from table2
set @l_max=@s_max*1.25
select * from table1 where cost between @s_max and @l_max