如此的sql语句,求原理
select a.Estimated_Arrival_Date_s from (
select estimated_arrival_date Estimated_Arrival_Date_s from Is_Issues_Plan_Detail where Estimated_Arrival_Date_s='aa'
)a
如此的sql语句,求原理为什么不能用Estimated_Arrival_Date_s='aa' 只能用estimated_arrival_date=‘aa’,求原理。。。。。。。。。。。。。。。
[解决办法]
跟sql的执行顺序有关
select a.Estimated_Arrival_Date_s from (select estimated_arrival_date Estimated_Arrival_Date_s from Is_Issues_Plan_Detail)awhere Estimated_Arrival_Date_s='aa'
[解决办法]
declare @T table (col varchar(1))insert into @Tselect 'a' union allselect 'b' union allselect 'c'--order by 后面就可以用别名select col a from @T order by a--where后面用别名的话就需要嵌套一层select col a from @T where a='b'/*Invalid column name 'a'.*/