有下面的 SQL
语句:
select count(*) from text_meta_ingest group by bool(clip_url_hash)
我希望可以统计 clip_url_hash
为:
- 为
null
、 - 为
''
(空字符) - 有实际值(长度大于 0)
这三种情况的 count
,我应该怎么写?
有下面的 SQL
语句:
select count(*) from text_meta_ingest group by bool(clip_url_hash)
我希望可以统计 clip_url_hash
为:
null
、''
(空字符)这三种情况的 count
,我应该怎么写?
就按你说的写啊,比如
select count(*) from text_meta_ingest group by IF(clip_url_hash is NULL, null, IF(clip_url_hash = '', '', 1));
嗯,你说的对...
select sum(if(core_chemical_code is null, 1, 0)) as totalNull, sum(if(core_chemical_code = '', 1, 0)) as totalEmpty, count(*) as total from text_meta_ingest
非空的行是 total - totalNull - totalEmpty
4 回答770 阅读✓ 已解决
8 回答1.1k 阅读
3 回答947 阅读✓ 已解决
2 回答1.6k 阅读
1 回答785 阅读✓ 已解决
2 回答962 阅读
1 回答574 阅读✓ 已解决
用 case when 一劳永逸哦
我测试的
