我只是想知道是否有办法访问我创建的新列,即'Age',以便我在下一列中的条件能够正常工作?这是我的代码,Advance谢谢你的回复^^ enter image description here
答案 0 :(得分:0)
将子查询用作:
SELECT CompleteName,DateofBirth,CASE WHEN Age >=60 then 'Y' WHEN Age<60 then
'N' ELSE 'Unknown' as IsSenior FROM (
SELECT LastName + ',' + FirstName + ',' + LEFT(MiddleName,1)+'.' as
CompleteName,DateofBirth, DATE(YEAR,DateofBirth,GETDate()) as Age
) as A