ms sql :select * from (select *from b) as xxx where 和 select * from (select *from b) xxx where区
ms sql :select * from (select *from b) as xxx where 和 select * from (select *from b) xxx where区
select * from (select *from b) as xxx where…… 和 select * from (select *from b) xxx where……的区别
别告诉我是一样的.
因为我有一个存储过程
set @query= 'select *
from (select Food.*,Supplier.SupplierName,Row_number()over( '+@orderQuery+' ) as IDRank from '+@tableName+' ' +@checkQuery+' ) xx
where xx.IDRank between ……(省略了)'
这个是对的.
我改成
set @query= 'select *
from (select Food.*,Supplier.SupplierName,Row_number()over( '+@orderQuery+' ) as IDRank from '+@tableName+' ' +@checkQuery+' ) as xx
where IDRank between……(省略了)‘
之后,也可以执行
但是如果改为
set @query= 'select *
from (select Food.*,Supplier.SupplierName,Row_number()over( '+@orderQuery+' ) as IDRank from '+@tableName+' ' +@checkQuery+' )
where IDRank between……(省略了)‘
就不能执行了
select * from (select *from b) as xxx where
select * from (select *from b) xxx where
确实是一样的,但是第三句相当于
select * from (select *from b) where
这个有错误.