发布于 2021-06-18 19:10:26
如何计算每个日期的null(当评论和卖家为null时)?
想必,你想要这样的东西:
select date, sum(case when comment is null and seller is null then 1 else 0 end) as both_null
from t
group by date;发布于 2021-06-18 19:19:03
在where子句的帮助下,选择在注释和卖方列中只有null的行。然后只需使用group by进行计数。我还将order_time列转换为date。
select cast(order_time as date) order_date, count(*) null_count
from yourtable
where comment is null and seller is null
group by cast(order_time as date);https://stackoverflow.com/questions/68034089
复制相似问题