您的位置:首页 > 数据库

SQL: 某个时间段范围内,产品有价格,且求平均数

2017-06-29 18:08 513 查看
select ID,AVG(fPrice) as avgPrice from Price
where Hp_Date >='2017-07-04' and  Hp_Date <='2017-07-06'
group by ID
having SUM(case when ISNULL(fPrice,0) > 0 and Status=0 then 1 else 0 end)=天数
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: