在我的 sql server 代码中,我有这个 select 语句
select distinct
a.HireLastName,
a.HireFirstName,
a.HireID,
a.Position_ID,
a.BarNumber,
a.Archived,
a.DateArchived,
b.Position_Name
from NewHire a
join Position b on a.Position_ID = b.Position_ID
join WorkPeriod c on a.hireID = c.HireID
where a.Archived = 0 and c.InquiryID is not null
order by a.HireID DESC, a.HireLastName, a.HireFirstName
我想向它添加一个新列。但是,此列不是表中的列,它仅用于存储float
我从现有列中进行的计算。
我得到的数字是这样计算的:
@acc
是a.HireID
来自上面的 select 语句。
CAST((select COUNT(*) from Hire_Response WHERE HireID = @acc AND (HireResponse = 0 OR HireResponse = 1)) as FLOAT) /
CAST((select COUNT(*) from Hire_Response WHERE HireID = @acc) as FLOAT)
我怎样才能做到这一点?谢谢。