如何写两个select语句在一个查询的一个结果,我希望两个SELECT语句的一个结果相结合的平均如何写两个select语句在一个查询的一个结果
结果查询,如: -
select (idcount/days) as avg
QUERY1: -
select distinct COUNT(id) as idcount
from employee
where joiningdate between CONVERT(varchar,@fromdate,103) and CONVERT(varchar,@TODATE,103)
QUERY2: -
select DATEDIFF(d,@FromDate,@todate) as days
使用子查询你的结果 –