我只要聚合函數,表值函數和標量函數就不要冒充了我只要Sql語句創建聚合函數C#的 繞道
2 回答

梵蒂岡之花
TA貢獻1900條經驗 獲得超5個贊
有兩個寫法:
select * from tblDept
where id in(select DeptID from tblSalary group by DeptID having
count(case when Salary>3000 then 1 else null end)*1.0/count(*)>0.5)
或
select * from tblDept
where id in(select DeptID from tblSalary group by DeptID having
sum(case when Salary>3000 then 1 else 0 end)*1.0/count(*)>0.5)
- 2 回答
- 0 關注
- 1321 瀏覽
添加回答
舉報
0/150
提交
取消