在 ms-sql 2000 的 where 子句中使用别名列 [英] Using an Alias column in the where clause in ms-sql 2000

查看:34
本文介绍了在 ms-sql 2000 的 where 子句中使用别名列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道您不能在 T-SQL 的 where 子句中使用别名列;但是,微软是否为此提供了某种解决方法?

I know you cannot use a alias column in the where clause for T-SQL; however, has Microsoft provided some kind of workaround for this?

相关问题:

推荐答案

一种解决方法是使用派生表.

One workaround would be to use a derived table.

例如:

select *
from 
   (
   select a + b as aliased_column
   from table
   ) dt
where dt.aliased_column = something.

我希望这会有所帮助.

这篇关于在 ms-sql 2000 的 where 子句中使用别名列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆