sql 列名无效

2025-01-06 15:43:37
推荐回答(3个)
回答1:

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

select username+'-'+userpwd as zd from user where username+'-'+userpwd='admin-1111'

回答2:

zd 不能在where条件中使用

select username+'-'+userpwd as zd
from user
where username='admin'
and userpwd ='1111'

回答3:

select username+'-'+userpwd as zd from [user] where username+'-'+userpwd='admin-1111'