cha*_*ara 2 sql-server sql-server-2005
我想编写一个查询中检索COUNT(of employees with the salary=1000)并COUNT(of total no of employees)从同一个表.有任何想法吗??
另一种方法:
SELECT
COUNT(*) AS total_employees,
SUM(CASE WHEN salary = 1000 THEN 1 ELSE 0 END) AS employees_with_1000_salary
FROM
Employees
Run Code Online (Sandbox Code Playgroud)