我有 3 个查询需要合并为一个。他们来了
SELECT COUNT(e.EmployeeID) AS TotalEmpCount
FROM Employees as e
WHERE HomePhone <> ''
SELECT COUNT(e.EmployeeID) AS USEmpCount
FROM Employees as e
INNER JOIN Orders as o ON e.EmployeeID=o.EmployeeID
WHERE e.HomePhone <> '' AND e.Country='US' AND o.OrderDate BETWEEN '11/01/2011' AND GETDATE()
SELECT COUNT(e.EmployeeID) AS UKEmpCount
FROM Employees as e
INNER JOIN Orders as o ON e.EmployeeID=o.EmployeeID
WHERE HomePhone <> '' AND Country ='UK' AND o.OrderDate BETWEEN '01/01/2011' AND '12/31/2012'
我需要一个返回 3 列的查询:TotalEmpCount、USEmpCount、UKEmpCount。
我需要 T-SQL 和 Linq 格式的这个查询