我只要聚合函數(shù),表值函數(shù)和標(biāo)量函數(shù)就不要冒充了我只要Sql語句創(chuàng)建聚合函數(shù)C#的 繞道
2 回答

梵蒂岡之花
TA貢獻(xiàn)1900條經(jīng)驗(yàn) 獲得超5個(gè)贊
有兩個(gè)寫法:
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 關(guān)注
- 1330 瀏覽
添加回答
舉報(bào)
0/150
提交
取消