sql 列名无效

select username+'-'+userpwd as zd from user where zd='admin-1111' ,我用这个语句为什么出现 列名zd无效 的错误?

前面部分select username+'-'+userpwd as zd from user 是可以查询的

如何修改?

别名不能用在查询条件里吧。

select username+'-'+userpwd as zd from user where username+'-'+userpwd='admin-1111'
温馨提示:答案为网友推荐,仅供参考
第1个回答  2010-07-15
zd 不能在where条件中使用

select username+'-'+userpwd as zd
from user
where username='admin'
and userpwd ='1111'
第2个回答  2010-07-15
select username+'-'+userpwd as zd from [user] where username+'-'+userpwd='admin-1111'

相关了解……

你可能感兴趣的内容

大家正在搜

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网